2021-07-14 23:52:46 +03:00
|
|
|
import siteMetadata from '@/data/siteMetadata'
|
|
|
|
import dynamic from 'next/dynamic'
|
|
|
|
|
|
|
|
const UtterancesComponent = dynamic(
|
|
|
|
() => {
|
|
|
|
return import('@/components/comments/Utterances')
|
|
|
|
},
|
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
const GiscusComponent = dynamic(
|
|
|
|
() => {
|
|
|
|
return import('@/components/comments/Giscus')
|
|
|
|
},
|
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
const DisqusComponent = dynamic(
|
|
|
|
() => {
|
|
|
|
return import('@/components/comments/Disqus')
|
|
|
|
},
|
|
|
|
{ ssr: false }
|
|
|
|
)
|
|
|
|
|
|
|
|
const Comments = ({ frontMatter }) => {
|
2022-02-25 23:19:56 -05:00
|
|
|
const comment = siteMetadata?.comment
|
|
|
|
if (!comment || Object.keys(comment).length === 0) return <></>
|
2021-07-14 23:52:46 +03:00
|
|
|
return (
|
2021-09-11 19:29:54 +07:00
|
|
|
<div id="comment">
|
2022-04-22 17:02:24 -07:00
|
|
|
{siteMetadata.comment && siteMetadata.comment.provider === 'giscus' && <GiscusComponent />}
|
2021-07-14 23:52:46 +03:00
|
|
|
{siteMetadata.comment && siteMetadata.comment.provider === 'utterances' && (
|
2022-04-22 17:02:24 -07:00
|
|
|
<UtterancesComponent />
|
2021-07-14 23:52:46 +03:00
|
|
|
)}
|
|
|
|
{siteMetadata.comment && siteMetadata.comment.provider === 'disqus' && (
|
|
|
|
<DisqusComponent frontMatter={frontMatter} />
|
|
|
|
)}
|
2021-09-11 19:29:54 +07:00
|
|
|
</div>
|
2021-07-14 23:52:46 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Comments
|