2022-01-09 20:12:31 +00:00
|
|
|
import React from "react";
|
2022-04-17 13:37:29 +00:00
|
|
|
|
|
|
|
import { DiscussionEmbed } from "disqus-react";
|
2018-11-09 20:08:48 +03:00
|
|
|
|
2022-01-09 20:12:31 +00:00
|
|
|
import { useSiteMetadata } from "@/hooks";
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
postTitle: string;
|
|
|
|
postSlug: string;
|
|
|
|
}
|
2019-05-10 02:15:43 +03:00
|
|
|
|
2022-01-09 20:12:31 +00:00
|
|
|
const Comments: React.FC<Props> = ({ postTitle, postSlug }: Props) => {
|
2019-05-09 16:57:42 +03:00
|
|
|
const { url, disqusShortname } = useSiteMetadata();
|
2018-11-09 20:08:48 +03:00
|
|
|
|
2019-01-24 20:44:13 +03:00
|
|
|
if (!disqusShortname) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-11-09 20:08:48 +03:00
|
|
|
return (
|
2022-04-17 13:37:29 +00:00
|
|
|
<DiscussionEmbed
|
2018-11-09 20:08:48 +03:00
|
|
|
shortname={disqusShortname}
|
2022-04-17 13:37:29 +00:00
|
|
|
config={{
|
|
|
|
url: url + postSlug,
|
|
|
|
identifier: postTitle,
|
|
|
|
title: postTitle,
|
|
|
|
}}
|
2018-11-09 20:08:48 +03:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Comments;
|