Files
NotionNext/components/ShareBar.js
2023-11-08 19:05:35 +08:00

30 lines
840 B
JavaScript

import { siteConfig } from '@/lib/config'
import { useRouter } from 'next/router'
import React from 'react'
import ShareButtons from './ShareButtons'
const ShareBar = ({ post }) => {
const router = useRouter()
if (!JSON.parse(siteConfig('POST_SHARE_BAR_ENABLE')) || !post || post?.type !== 'Post') {
return <></>
}
const shareUrl = siteConfig('LINK') + router.asPath
return <div className='m-1 overflow-x-auto'>
<div className='flex w-full md:justify-end'>
<ShareButtons shareUrl={shareUrl} title={post.title} image={post.pageCover} body={
post?.title +
' | ' +
siteConfig('TITLE') +
' ' +
shareUrl +
' ' +
post?.summary
} />
</div>
</div>
}
export default ShareBar