Skip to content

Commit

Permalink
Add giscus comment section (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk authored Aug 27, 2023
1 parent 1531933 commit 32fa7f8
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 0 deletions.
129 changes: 129 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@fortawesome/free-brands-svg-icons": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@giscus/react": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@react-spring/web": "^9.7.2",
"@tippyjs/react": "^4.2.6",
Expand Down
41 changes: 41 additions & 0 deletions src/components/giscus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from "react";
import Giscus from "@giscus/react";
import {ThemeContext} from "./ThemeContext";

/* <script src="https://giscus.app/client.js"
data-repo="naveen521kk/naveen521kk.github.io"
data-repo-id="MDEwOlJlcG9zaXRvcnkyOTU2NjY0ODk="
data-category="Announcements"
data-category-id="DIC_kwDOEZ-DOc4CWtyY"
data-mapping="pathname"
data-strict="1"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="top"
data-theme="transparent_dark"
data-lang="en"
data-loading="lazy"
crossorigin="anonymous"
async>
</script> */

export default function GiscusComment() {
const {colorMode} = React.useContext(ThemeContext);
return (
<Giscus
id="comments"
repo="naveen521kk/naveen521kk.github.io"
repoId="MDEwOlJlcG9zaXRvcnkyOTU2NjY0ODk="
category="Announcements"
categoryId="DIC_kwDOEZ-DOc4CWtyY"
mapping="pathname"
strict="1"
reactionsEnabled="1"
emitMetadata="0"
inputPosition="top"
theme={colorMode === "dark" ? "dark" : "light"}
lang="en"
loading="lazy"
/>
);
}
9 changes: 9 additions & 0 deletions src/styles/posts-style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,13 @@
border-radius: 0.5rem;
background-color: var(--#{$prefix}tag-background-color);
color: var(--#{$prefix}tag-color);
}

.giscusComment {
margin-top: 2rem;
margin-bottom: 5rem;

@media (min-width: 768px) {
margin-bottom: 2rem;
}
}
4 changes: 4 additions & 0 deletions src/templates/blog-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {JsonLd} from "../components/json_ld";
import NavBar from "../components/header.tsx";
import BgPhoto from "../components/bgphoto.jsx";
import ScrollProgressBar from "../components/scroll-progress-bar";
import GiscusComment from "../components/giscus";
import * as styles from "../styles/posts-style.module.scss";
import "../styles/posts.scss";

Expand Down Expand Up @@ -87,6 +88,9 @@ const BlogPostTemplate = ({data, location, children}) => {
</div>
</div>
</article>
<div className={styles.outer_class + " " + styles.giscusComment}>
<GiscusComment />
</div>
<ScrollProgressBar />
{/* <nav className="blog-post-nav">
<ul
Expand Down

0 comments on commit 32fa7f8

Please sign in to comment.