2023-08-16 23:55:57 +08:00
|
|
|
'use client';
|
2023-08-16 23:29:22 +08:00
|
|
|
|
2023-08-16 23:55:57 +08:00
|
|
|
import { Comments as CommentsComponent } from 'pliny/comments';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import siteMetadata from '@/data/siteMetadata';
|
2023-08-16 23:29:22 +08:00
|
|
|
|
|
|
|
export default function Comments({ slug }: { slug: string }) {
|
2023-08-16 23:55:57 +08:00
|
|
|
const [loadComments, setLoadComments] = useState(false);
|
2023-08-16 23:29:22 +08:00
|
|
|
return (
|
|
|
|
<>
|
2023-08-16 23:55:57 +08:00
|
|
|
{!loadComments && (
|
|
|
|
<button onClick={() => setLoadComments(true)}>Load Comments</button>
|
|
|
|
)}
|
2023-08-16 23:29:22 +08:00
|
|
|
{siteMetadata.comments && loadComments && (
|
|
|
|
<CommentsComponent commentsConfig={siteMetadata.comments} slug={slug} />
|
|
|
|
)}
|
|
|
|
</>
|
2023-08-16 23:55:57 +08:00
|
|
|
);
|
2023-08-16 23:29:22 +08:00
|
|
|
}
|