42 lines
798 B
JavaScript
Raw Normal View History

2018-11-09 20:08:48 +03:00
import React from 'react';
import { graphql, StaticQuery } from 'gatsby';
import ReactDisqusComments from 'react-disqus-comments';
export const PureComments = ({ data, postTitle, postSlug }) => {
const {
url,
2018-11-09 20:08:48 +03:00
disqusShortname
} = data.site.siteMetadata;
if (!disqusShortname) {
return null;
}
2018-11-09 20:08:48 +03:00
return (
<ReactDisqusComments
shortname={disqusShortname}
identifier={postTitle}
title={postTitle}
url={url + postSlug}
2018-11-09 20:08:48 +03:00
/>
);
};
export const Comments = (props) => (
<StaticQuery
query={graphql`
query CommentsQuery {
site {
siteMetadata {
disqusShortname
url
}
}
}
`}
render={(data) => <PureComments {...props} data={data}/>}
/>
);
export default Comments;