import Link from '@/components/Link'; import PageTitle from '@/components/PageTitle'; import SectionContainer from '@/components/SectionContainer'; import { BlogSEO } from '@/components/SEO'; import Image from '@/components/Image'; import Tag from '@/components/Tag'; import siteMetadata from '@/data/siteMetadata'; import Comments from '@/components/comments'; import ScrollTopAndComment from '@/components/ScrollTopAndComment'; import { ReactNode, useMemo } from 'react'; import { PostFrontMatter } from 'types/PostFrontMatter'; import { AuthorFrontMatter } from 'types/AuthorFrontMatter'; const editUrl = (fileName) => `${siteMetadata.siteRepo}/raw/master/data/blog/${fileName}`; const discussUrl = (slug) => `https://mobile.twitter.com/search?q=${encodeURIComponent( `${siteMetadata.siteUrl}/blog/${slug}` )}`; const Copyright = () => ( 知识共享许可协议 ); const postDateTemplate: Intl.DateTimeFormatOptions = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', }; interface Props { frontMatter: PostFrontMatter; authorDetails: AuthorFrontMatter[]; next?: { slug: string; title: string }; prev?: { slug: string; title: string }; children: ReactNode; } export default function PostLayout({ frontMatter, authorDetails, next, prev, children, }: Props) { const { slug, fileName, date, title, images, tags } = frontMatter; const headerStyles = useMemo( () => images?.[0] ? { backgroundImage: `url(${images[0]})`, } : {}, [images] ); return (
{images?.[0] && ( background )}
Published on
{title}
Authors
    {authorDetails.map((author) => (
  • {author.avatar && ( avatar )}
    Name
    {author.name}
    Twitter
    {author.twitter && ( {author.twitter.replace( 'https://twitter.com/', '@' )} )}
  • ))}
{children}
{'View source'}
); }