File tree Expand file tree Collapse file tree 3 files changed +24
-21
lines changed Expand file tree Collapse file tree 3 files changed +24
-21
lines changed Original file line number Diff line number Diff line change 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
+ });
20
21
21
22
useEffect(() => {
22
23
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import Datetime from "@components/Datetime";
7
7
import type { CollectionEntry } from " astro:content" ;
8
8
import { slugifyStr } from " @utils/slugify" ;
9
9
import ShareLinks from " @components/ShareLinks.astro" ;
10
- import Comments from " @components/Comments" ;
11
10
import { SITE } from " @config" ;
12
11
13
12
export interface Props {
@@ -181,8 +180,11 @@ const nextPost =
181
180
182
181
<!--
183
182
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
+ <!--
185
186
<Comments client:only="react" />
187
+ -->
186
188
<!-- <script async src="https://giscus.app/client.js"-->
187
189
<!-- data-repo="[ENTER REPO HERE]"-->
188
190
<!-- data-repo-id="[ENTER REPO ID HERE]"-->
File renamed without changes.
You can’t perform that action at this time.
0 commit comments