@@ -5,15 +5,16 @@ import { createPopper } from '@popperjs/core'
5
5
import copy from 'copy-to-clipboard'
6
6
import QRCode from 'qrcode.react'
7
7
import { useGlobal } from '@/lib/global'
8
- import CONFIG_NEXT from '../config_next'
9
8
10
9
const ShareBar = ( { post } ) => {
11
10
const router = useRouter ( )
12
11
const [ qrCodeShow , setQrCodeShow ] = React . useState ( false )
13
12
const { locale } = useGlobal ( )
14
- if ( ! CONFIG_NEXT . ARTICLE_SHARE ) {
13
+
14
+ if ( ! JSON . parse ( BLOG . POST_SHARE_BAR_ENABLE ) || ! post || post ?. type !== 'Post' ) {
15
15
return < > </ >
16
16
}
17
+
17
18
const shareUrl = BLOG . LINK + router . asPath
18
19
19
20
// 二维码悬浮
@@ -35,26 +36,25 @@ const ShareBar = ({ post }) => {
35
36
alert ( locale . COMMON . URL_COPIED )
36
37
}
37
38
38
- return < >
39
- < div
39
+ return < div id = 'share-bar'
40
40
className = 'py-2 text-gray-500 text-center space-x-2 flex my-1 dark:text-gray-200 overflow-visible' >
41
41
< div className = 'hidden md:block text-gray-800 dark:text-gray-300 mr-2 my-2 whitespace-nowrap' > { locale . COMMON . SHARE } :</ div >
42
- < div className = 'text-3xl cursor-pointer' >
42
+ < div className = 'text-3xl cursor-pointer w-6 ' >
43
43
< a className = 'text-blue-700' href = { `https://www.facebook.com/sharer.php?u=${ shareUrl } ` } >
44
44
< i className = 'fab fa-facebook-square' />
45
45
</ a >
46
46
</ div >
47
- < div className = 'text-3xl cursor-pointer' >
47
+ < div className = 'text-3xl cursor-pointer w-6 ' >
48
48
< a className = 'text-blue-400' target = '_blank' rel = 'noreferrer' href = { `https://twitter.com/intent/tweet?title=${ post . title } &url${ shareUrl } ` } >
49
49
< i className = 'fab fa-twitter-square' />
50
50
</ a >
51
51
</ div >
52
- < div className = 'text-3xl cursor-pointer' >
52
+ < div className = 'text-3xl cursor-pointer w-6 ' >
53
53
< a className = 'text-blue-500' href = { `https://telegram.me/share/url?url=${ shareUrl } &text=${ post . title } ` } >
54
54
< i className = 'fab fa-telegram' />
55
55
</ a >
56
56
</ div >
57
- < div className = 'cursor-pointer text-2xl' >
57
+ < div className = 'cursor-pointer text-2xl w-6 ' >
58
58
< a className = 'text-green-600' ref = { btnRef } onMouseEnter = { openPopover } onMouseLeave = { closePopover } >
59
59
< i className = 'fab fa-weixin' />
60
60
< div ref = { popoverRef } className = { ( qrCodeShow ? 'opacity-100 ' : 'invisible opacity-0' ) + ' transition-all duration-200 text-center py-2' } >
@@ -67,22 +67,21 @@ const ShareBar = ({ post }) => {
67
67
</ div >
68
68
</ a >
69
69
</ div >
70
- < div className = 'cursor-pointer text-2xl' >
70
+ < div className = 'cursor-pointer text-2xl w-6 ' >
71
71
< a className = 'text-red-600' target = '_blank' rel = 'noreferrer' href = { `https://service.weibo.com/share/share.php?url=${ shareUrl } &title=${ post . title } ` } >
72
72
< i className = 'fab fa-weibo' />
73
73
</ a >
74
74
</ div >
75
- < div className = 'cursor-pointer text-2xl' >
75
+ < div className = 'cursor-pointer text-2xl w-6 ' >
76
76
< a className = 'text-blue-400' target = '_blank' rel = 'noreferrer' href = { `http://connect.qq.com/widget/shareqq/index.html?url=${ shareUrl } &sharesource=qzone&title=${ post . title } &desc=${ post . summary } ` } >
77
77
< i className = 'fab fa-qq' />
78
78
</ a >
79
79
</ div >
80
- < div className = 'cursor-pointer text-2xl' >
80
+ < div className = 'cursor-pointer text-2xl w-6 ' >
81
81
< a className = 'text-yellow-600' onClick = { copyUrl } >
82
82
< i className = 'fas fa-link' />
83
83
</ a >
84
84
</ div >
85
85
</ div >
86
- </ >
87
86
}
88
87
export default ShareBar
0 commit comments