Files
NotionNext/components/ShareBar.js
tangly1024.com 3b181f3069 load 优化
2023-12-01 12:50:54 +08:00

31 lines
861 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()
const title = siteConfig('TITLE')
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 +
' | ' +
title +
' ' +
shareUrl +
' ' +
post?.summary
} />
</div>
</div>
}
export default ShareBar