sync with pliny dev

This commit is contained in:
Timothy Lin
2023-07-16 18:52:51 +08:00
parent d61487efa4
commit 20704c9f75
18 changed files with 356 additions and 684 deletions

View File

@ -1,7 +1,7 @@
import { useState, ReactNode } from 'react'
import { Comments } from 'pliny/comments'
import { ReactNode } from 'react'
import { CoreContent } from 'pliny/utils/contentlayer'
import type { Blog, Authors } from 'contentlayer/generated'
import Comments from '@/components/Comments'
import Link from '@/components/Link'
import PageTitle from '@/components/PageTitle'
import SectionContainer from '@/components/SectionContainer'
@ -33,7 +33,6 @@ interface LayoutProps {
export default function PostLayout({ content, authorDetails, next, prev, children }: LayoutProps) {
const { filePath, path, slug, date, title, tags } = content
const basePath = path.split('/')[0]
// const [loadComments, setLoadComments] = useState(false)
return (
<SectionContainer>
@ -107,10 +106,7 @@ export default function PostLayout({ content, authorDetails, next, prev, childre
className="pb-6 pt-6 text-center text-gray-700 dark:text-gray-300"
id="comment"
>
{/* {!loadComments && (
<button onClick={() => setLoadComments(true)}>Load Comments</button>
)}
{loadComments && <Comments commentsConfig={siteMetadata.comments} slug={slug} />} */}
<Comments slug={slug} />
</div>
)}
</div>

View File

@ -1,8 +1,8 @@
import { useState, ReactNode } from 'react'
import { Comments } from 'pliny/comments'
import { ReactNode } from 'react'
import { formatDate } from 'pliny/utils/formatDate'
import { CoreContent } from 'pliny/utils/contentlayer'
import type { Blog } from 'contentlayer/generated'
import Comments from '@/components/Comments'
import Link from '@/components/Link'
import PageTitle from '@/components/PageTitle'
import SectionContainer from '@/components/SectionContainer'
@ -17,8 +17,6 @@ interface LayoutProps {
}
export default function PostLayout({ content, next, prev, children }: LayoutProps) {
const [loadComments, setLoadComments] = useState(false)
const { path, slug, date, title } = content
return (
@ -47,10 +45,7 @@ export default function PostLayout({ content, next, prev, children }: LayoutProp
</div>
{siteMetadata.comments && (
<div className="pb-6 pt-6 text-center text-gray-700 dark:text-gray-300" id="comment">
{!loadComments && (
<button onClick={() => setLoadComments(true)}>Load Comments</button>
)}
{loadComments && <Comments commentsConfig={siteMetadata.comments} slug={slug} />}
<Comments slug={slug} />
</div>
)}
<footer>