Merge remote-tracking branch 'origin/main' into theme-hexo

This commit is contained in:
tangly1024
2022-01-28 10:27:11 +08:00
2 changed files with 24 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ import LogoBar from './components/LogoBar'
* @constructor
*/
const LayoutBase = props => {
const { children, meta } = props
const { children, meta, showInfoCard = true } = props
return (
<div className='bg-white w-full h-full min-h-screen justify-center'>
@@ -19,7 +19,7 @@ const LayoutBase = props => {
<main id="wrapper" className='max-w-7xl w-full h-full mx-auto'>
<LogoBar/>
<div className='pt-12 fixed top-24 w-80 pl-8 hidden lg:block'>
<InfoCard/>
{showInfoCard && <InfoCard/>}
</div>
<div className='lg:ml-72 max-w-3xl w-full px-5'>
{children}

View File

@@ -9,6 +9,10 @@ import 'prismjs/components/prism-typescript'
import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x'
import LayoutBase from './LayoutBase'
import Comment from '@/components/Comment'
import Image from 'next/image'
import { useGlobal } from '@/lib/global'
import formatDate from '@/lib/formatDate'
import Link from 'next/link'
const mapPageUrl = id => {
return 'https://www.notion.so/' + id.replace(/-/g, '')
@@ -27,9 +31,25 @@ export const LayoutSlug = (props) => {
post.content = Object.keys(post.blockMap.block)
post.toc = getPageTableOfContents(post, post.blockMap)
}
const { locale } = useGlobal()
const date = formatDate(post?.date?.start_date || post.createdTime, locale.LOCALE)
return <LayoutBase {...props} meta={meta}>
<h1 className='text-4xl mt-12'>{post?.title}</h1>
return <LayoutBase {...props} meta={meta} showInfoCard={false}>
<h1 className='text-4xl mt-12 font-sans'>{post?.title}</h1>
<Link href='/about' passHref>
<div className='flex py-3 items-center font-sans cursor-pointer'>
<Image
alt={BLOG.AUTHOR}
width={25}
height={25}
loading='lazy'
src='/avatar.jpg'
className='rounded-full'
/>
<div className='mr-3 ml-1 text-green-500'>{BLOG.AUTHOR}</div>
<div className='text-gray-500'>{date}</div>
</div>
</Link>
{/* Notion文章主体 */}
<section id='notion-article' className='px-1 max-w-5xl'>
{post.blockMap && (