diff --git a/components/ShareButtons.js b/components/ShareButtons.js index 5ea54055..29fd37b4 100644 --- a/components/ShareButtons.js +++ b/components/ShareButtons.js @@ -5,48 +5,48 @@ import { useRouter } from 'next/router' import { useEffect, useState } from 'react' import { - EmailIcon, - EmailShareButton, - FacebookIcon, - FacebookMessengerIcon, - FacebookMessengerShareButton, - FacebookShareButton, - HatenaIcon, - HatenaShareButton, - InstapaperIcon, - InstapaperShareButton, - LineIcon, - LineShareButton, - LinkedinIcon, - LinkedinShareButton, - LivejournalIcon, - LivejournalShareButton, - MailruIcon, - MailruShareButton, - OKIcon, - OKShareButton, - PinterestIcon, - PinterestShareButton, - PocketIcon, - PocketShareButton, - RedditIcon, - RedditShareButton, - TelegramIcon, - TelegramShareButton, - TumblrIcon, - TumblrShareButton, - TwitterIcon, - TwitterShareButton, - VKIcon, - VKShareButton, - ViberIcon, - ViberShareButton, - WeiboIcon, - WeiboShareButton, - WhatsappIcon, - WhatsappShareButton, - WorkplaceIcon, - WorkplaceShareButton + EmailIcon, + EmailShareButton, + FacebookIcon, + FacebookMessengerIcon, + FacebookMessengerShareButton, + FacebookShareButton, + HatenaIcon, + HatenaShareButton, + InstapaperIcon, + InstapaperShareButton, + LineIcon, + LineShareButton, + LinkedinIcon, + LinkedinShareButton, + LivejournalIcon, + LivejournalShareButton, + MailruIcon, + MailruShareButton, + OKIcon, + OKShareButton, + PinterestIcon, + PinterestShareButton, + PocketIcon, + PocketShareButton, + RedditIcon, + RedditShareButton, + TelegramIcon, + TelegramShareButton, + TumblrIcon, + TumblrShareButton, + TwitterIcon, + TwitterShareButton, + ViberIcon, + ViberShareButton, + VKIcon, + VKShareButton, + WeiboIcon, + WeiboShareButton, + WhatsappIcon, + WhatsappShareButton, + WorkplaceIcon, + WorkplaceShareButton } from 'react-share' const QrCode = dynamic(() => import('@/components/QrCode'), { ssr: false }) @@ -61,6 +61,8 @@ const ShareButtons = ({ post }) => { const [shareUrl, setShareUrl] = useState(siteConfig('LINK') + router.asPath) const title = post?.title || siteConfig('TITLE') const image = post?.pageCover + const tags = post.tags || [] + const hashTags = tags.map(tag => `#${tag}`).join(',') const body = post?.title + ' | ' + title + ' ' + shareUrl + ' ' + post?.summary @@ -90,299 +92,282 @@ const ShareButtons = ({ post }) => { return ( <> {services.map(singleService => { - if (singleService === 'facebook') { - return ( - - - - ) - } - if (singleService === 'messenger') { - return ( - - - - ) - } - if (singleService === 'line') { - return ( - - - - ) - } - if (singleService === 'reddit') { - return ( - - - - ) - } - if (singleService === 'email') { - return ( - - - - ) - } - if (singleService === 'twitter') { - return ( - - - - ) - } - if (singleService === 'telegram') { - return ( - - - - ) - } - if (singleService === 'whatsapp') { - return ( - - - - ) - } - if (singleService === 'linkedin') { - return ( - - - - ) - } - if (singleService === 'pinterest') { - return ( - - - - ) - } - if (singleService === 'vkshare') { - return ( - - - - ) - } - if (singleService === 'okshare') { - return ( - - - - ) - } - if (singleService === 'tumblr') { - return ( - - - - ) - } - if (singleService === 'livejournal') { - return ( - - - - ) - } - if (singleService === 'mailru') { - return ( - - - - ) - } - if (singleService === 'viber') { - return ( - - - - ) - } - if (singleService === 'workplace') { - return ( - - - - ) - } - if (singleService === 'weibo') { - return ( - - - - ) - } - if (singleService === 'pocket') { - return ( - - - - ) - } - if (singleService === 'instapaper') { - return ( - - - - ) - } - if (singleService === 'hatena') { - return ( - - - - ) - } - if (singleService === 'qq') { - return ( - - ) - } - if (singleService === 'wechat') { - return ( - + ) + case 'wechat': + return ( + - ) +
+
+
+ {qrCodeShow && } +
+ + {locale.COMMON.SCAN_QR_CODE} + +
+
+ + ) + case 'link': + return ( + + ) + default: + return <> } - if (singleService === 'link') { - return ( - - ) - } - return <> })} )