Skip to content

Commit

Permalink
add disqus component
Browse files Browse the repository at this point in the history
  • Loading branch information
Tu Huynh committed Feb 2, 2019
1 parent 3135d20 commit 21417aa
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -6,6 +6,7 @@
"ant-design-pro": "^1.4.4",
"antd": "^3.9.3",
"axios": "^0.18.0",
"disqus-react": "^1.0.5",
"dotenv": "6.0.0",
"express": "^4.16.2",
"firebase": "^5.7.3",
Expand Down
6 changes: 6 additions & 0 deletions src/app/modules/home/Post.js
Expand Up @@ -6,6 +6,7 @@ import Helmet from "react-helmet-async";
import styled from "styled-components";
import Loading from "../loading/Loading";
import NotFound from "../not-found/NotFound";
import DisqusComponent from "../../utils/shared/disqus/DisqusComponent";

const { Content } = Layout;

Expand Down Expand Up @@ -150,6 +151,11 @@ Quay lại danh sách bài
__html: post && post.content,
}}
/>

<DisqusComponent
guid={post && post.guid}
title={post && post.title}
/>
</PostBody>
</div>
</Content>
Expand Down
6 changes: 6 additions & 0 deletions src/app/modules/medium/Post.js
Expand Up @@ -7,6 +7,7 @@ import styled from "styled-components";
import axios from "axios";
import Loading from "../loading/Loading";
import NotFound from "../not-found/NotFound";
import DisqusComponent from "../../utils/shared/disqus/DisqusComponent";

const { Content } = Layout;

Expand Down Expand Up @@ -199,6 +200,11 @@ class Post extends Component {
__html: post && post.content,
}}
/>

<DisqusComponent
guid={post && post.guid}
title={post && post.title}
/>
</PostBody>
</div>
</Content>
Expand Down
6 changes: 6 additions & 0 deletions src/app/modules/toidicodedao/Post.js
Expand Up @@ -6,6 +6,7 @@ import Helmet from "react-helmet-async";
import styled from "styled-components";
import Loading from "../loading/Loading";
import NotFound from "../not-found/NotFound";
import DisqusComponent from "../../utils/shared/disqus/DisqusComponent";

const { Content } = Layout;

Expand Down Expand Up @@ -147,6 +148,11 @@ Quay lại danh sách bài
__html: post && post.content,
}}
/>

<DisqusComponent
guid={post && post.guid}
title={post && post.title}
/>
</PostBody>
</div>
</Content>
Expand Down
23 changes: 23 additions & 0 deletions src/app/utils/shared/disqus/DisqusComponent.js
@@ -0,0 +1,23 @@
import React from "react";
import Disqus from "disqus-react";

const DisqusComponent = ({ guid, title }) => {
if (typeof window !== "undefined") {
const disqusConfig = {
url : window.location.href,
indentifier: guid,
title : title,
};

return (
<Disqus.DiscussionEmbed
shortname="fptu-tech"
config={disqusConfig}
/>
);
} else {
return null;
}
};

export default DisqusComponent;
20 changes: 19 additions & 1 deletion yarn.lock
Expand Up @@ -3829,6 +3829,14 @@ dir-glob@^2.0.0:
dependencies:
path-type "^3.0.0"

disqus-react@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/disqus-react/-/disqus-react-1.0.5.tgz#828ea186bd241c5e2a6dfebab5135e52a2d91d11"
integrity sha1-go6hhr0kHF4qbf66tRNeUqLZHRE=
dependencies:
react "^15.6.1"
react-dom "^15.6.1"

dlv@^1.1.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.2.tgz#270f6737b30d25b6657a7e962c784403f85137e5"
Expand Down Expand Up @@ -10043,6 +10051,16 @@ react-document-title@^2.0.3:
prop-types "^15.5.6"
react-side-effect "^1.0.2"

react-dom@^15.6.1:
version "15.6.2"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.6.2.tgz#41cfadf693b757faf2708443a1d1fd5a02bef730"
integrity sha1-Qc+t9pO3V/rycIRDodH9WgK+9zA=
dependencies:
fbjs "^0.8.9"
loose-envify "^1.1.0"
object-assign "^4.1.0"
prop-types "^15.5.10"

react-dom@^16.5.2:
version "16.7.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.7.0.tgz#a17b2a7ca89ee7390bc1ed5eb81783c7461748b8"
Expand Down Expand Up @@ -10205,7 +10223,7 @@ react-test-renderer@^16.0.0-0:
react-is "^16.7.0"
scheduler "^0.12.0"

react@^15.6.2:
react@^15.6.1, react@^15.6.2:
version "15.6.2"
resolved "https://registry.yarnpkg.com/react/-/react-15.6.2.tgz#dba0434ab439cfe82f108f0f511663908179aa72"
integrity sha1-26BDSrQ5z+gvEI8PURZjkIF5qnI=
Expand Down

0 comments on commit 21417aa

Please sign in to comment.