import BLOG from '@/blog.config' import { useGlobal } from '@/lib/global' import copy from 'copy-to-clipboard' import dynamic from 'next/dynamic' import { useState } from 'react' import { FacebookShareButton, FacebookIcon, FacebookMessengerShareButton, FacebookMessengerIcon, RedditShareButton, RedditIcon, LineShareButton, LineIcon, EmailShareButton, EmailIcon, TwitterShareButton, TwitterIcon, TelegramShareButton, TelegramIcon, WhatsappShareButton, WhatsappIcon, LinkedinShareButton, LinkedinIcon, PinterestShareButton, PinterestIcon, VKIcon, VKShareButton, OKShareButton, OKIcon, TumblrShareButton, TumblrIcon, LivejournalIcon, LivejournalShareButton, MailruShareButton, MailruIcon, ViberIcon, ViberShareButton, WorkplaceShareButton, WorkplaceIcon, WeiboShareButton, WeiboIcon, PocketShareButton, PocketIcon, InstapaperShareButton, InstapaperIcon, HatenaShareButton, HatenaIcon } from 'react-share' const QRCode = dynamic( () => { return import('qrcode.react') }, { ssr: false } ) /** * @author https://github.com/txs * @param {*} param0 * @returns */ const ShareButtons = ({ shareUrl, title, body, image }) => { const services = BLOG.POSTS_SHARE_SERVICES.split(',') const titleWithSiteInfo = title + ' | ' + BLOG.TITLE const { locale } = useGlobal() const [qrCodeShow, setQrCodeShow] = useState(false) const copyUrl = () => { copy(shareUrl) alert(locale.COMMON.URL_COPIED) } const openPopover = () => { setQrCodeShow(true) } const closePopover = () => { setQrCodeShow(false) } 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 } if (singleService === 'link') { return } return <> })} ) } export default ShareButtons