Skip to content

Commit 48c7bb0

Browse files
committed
Disable giscuss comments.
1 parent 5ca0f50 commit 48c7bb0

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

src/components/Comments.tsx renamed to src/components/Comments.tsx.txt

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
//import Giscus, { type Theme } from "@giscus/react";
2-
//import { GISCUS } from "@config";
3-
import { useEffect } from "react";
4-
5-
// interface CommentsProps {
6-
// lightTheme?: Theme;
7-
// darkTheme?: Theme;
8-
// }
9-
10-
export default function Comments() {
11-
// const [theme, setTheme] = useState(() => {
12-
// const currentTheme = localStorage.getItem("theme");
13-
// const browserTheme = window.matchMedia("(prefers-color-scheme: dark)")
14-
// .matches
15-
// ? "dark"
16-
// : "light";
17-
18-
// return currentTheme || browserTheme;
19-
// });
1+
import { useEffect, useState } from "react";
2+
3+
interface CommentsProps {
4+
lightTheme?: Theme;
5+
darkTheme?: Theme;
6+
}
7+
8+
export default function Comments({
9+
lightTheme = "light",
10+
darkTheme = "dark",
11+
}: CommentsProps) {
12+
const [theme, setTheme] = useState(() => {
13+
const currentTheme = localStorage.getItem("theme");
14+
const browserTheme = window.matchMedia("(prefers-color-scheme: dark)")
15+
.matches
16+
? "dark"
17+
: "light";
18+
19+
return currentTheme || browserTheme;
20+
});
2021

2122
useEffect(() => {
2223
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");

src/layouts/PostDetails.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Datetime from "@components/Datetime";
77
import type { CollectionEntry } from "astro:content";
88
import { slugifyStr } from "@utils/slugify";
99
import ShareLinks from "@components/ShareLinks.astro";
10-
import Comments from "@components/Comments";
1110
import { SITE } from "@config";
1211
1312
export interface Props {
@@ -181,8 +180,11 @@ const nextPost =
181180

182181
<!--
183182
https://github.com/giscus/giscus-component
184-
https://github.com/satnaing/astro-paper/blob/main/src/content/blog/how-to-integrate-giscus-comments.md -->
183+
https://github.com/satnaing/astro-paper/blob/main/src/content/blog/how-to-integrate-giscus-comments.md
184+
-->
185+
<!--
185186
<Comments client:only="react" />
187+
-->
186188
<!--<script async src="https://giscus.app/client.js"-->
187189
<!-- data-repo="[ENTER REPO HERE]"-->
188190
<!-- data-repo-id="[ENTER REPO ID HERE]"-->

0 commit comments

Comments
 (0)