import BLOG from '@/blog.config' import formatDate from '@/lib/formatDate' import { useGlobal } from '@/lib/global' import { getPageTableOfContents } from 'notion-utils' import { faFolderOpen } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import Link from 'next/link' import 'prismjs' import 'prismjs/components/prism-bash' import 'prismjs/components/prism-java' import 'prismjs/components/prism-javascript' import 'prismjs/components/prism-markup' import 'prismjs/components/prism-python' import 'prismjs/components/prism-typescript' import CONFIG_NEXT from '../NEXT/config_next' import ArticleDetail from './components/ArticleDetail' import LayoutBase from './LayoutBase' import TocDrawerButton from './components/TocDrawerButton' import { useRef } from 'react' import TocDrawer from './components/TocDrawer' export const LayoutSlug = props => { const { post } = props const meta = { title: `${post.title} | ${BLOG.TITLE}`, description: post.summary, type: 'article', tags: post.tags } const { locale } = useGlobal() const date = formatDate( post?.date?.start_date || post.createdTime, locale.LOCALE ) if (post?.blockMap?.block) { post.content = Object.keys(post.blockMap.block) post.toc = getPageTableOfContents(post, post.blockMap) } const headerSlot = (
{/* 文章Title */}
{post.title}
{post.category} | {post.type[0] !== 'Page' && ( <> {date} )}
| 次访问
) const drawerRight = useRef(null) const targetRef = typeof window !== 'undefined' ? document.getElementById('container') : null const floatSlot = post?.toc?.length > 1 ? (
{ drawerRight?.current?.handleSwitchVisible() }} />
) : null return (
) }