import BLOG from '@/blog.config' import BlogAround from '@/components/BlogAround' import Comment from '@/components/Comment' import RecommendPosts from '@/components/RecommendPosts' import ShareBar from '@/components/ShareBar' import TagItem from '@/components/TagItem' import TocDrawer from '@/components/TocDrawer' import TocDrawerButton from '@/components/TocDrawerButton' import formatDate from '@/lib/formatDate' import { useGlobal } from '@/lib/global' import { faEye, faFolderOpen } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import mediumZoom from 'medium-zoom' import Link from 'next/link' import { useRouter } from 'next/router' import 'prismjs' import 'prismjs/components/prism-bash' import 'prismjs/components/prism-javascript' import 'prismjs/components/prism-markup' import 'prismjs/components/prism-python' import 'prismjs/components/prism-typescript' import { useRef } from 'react' import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x' import ArticleCopyright from './ArticleCopyright' import Live2D from './Live2D' import WordCount from './WordCount' /** * * @param {*} param0 * @returns */ export default function ArticleDetail ({ post, blockMap, recommendPosts, prev, next }) { const targetRef = useRef(null) const drawerRight = useRef(null) const url = BLOG.link + useRouter().asPath const { locale } = useGlobal() const date = formatDate(post?.date?.start_date || post.createdTime, locale.LOCALE) const zoom = typeof window !== 'undefined' && mediumZoom({ container: '.notion-viewport', background: 'rgba(0, 0, 0, 0.2)', margin: getMediumZoomMargin() }) const zoomRef = useRef(zoom ? zoom.clone() : null) function attachZoom (image) { if (zoomRef.current) { (zoomRef.current).attach(image) } } const attachZoomRef = attachZoom return (<>
{post.type && !post.type.includes('Page') && post?.page_cover && (
{/* eslint-disable-next-line @next/next/no-img-element */} {post.title}
)} {/* 文章Title */}
{post.title}
{post.category} | {post.type[0] !== 'Page' && (<> {date} | )}
  |
{/*
*/}
{/* Notion文章主体 */}
{blockMap && ( )}
{/* 文章内嵌广告 */}
{/* 推荐文章 */} {/* 版权声明 */} {/* 标签列表 */}
{post.tagItems && (
{locale.COMMON.TAGS}:
{post.tagItems.map(tag => ( ))}
)}
{/* 评论互动 */}
{/* 悬浮目录按钮 */}
{ drawerRight.current.handleSwitchVisible() }} />
{/* 宠物 */} {BLOG.showPet && } ) } const mapPageUrl = id => { return 'https://www.notion.so/' + id.replace(/-/g, '') } function getMediumZoomMargin () { const width = window.innerWidth if (width < 500) { return 8 } else if (width < 800) { return 20 } else if (width < 1280) { return 30 } else if (width < 1600) { return 40 } else if (width < 1920) { return 48 } else { return 72 } }