-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathGiscusComments.tsx
More file actions
43 lines (38 loc) · 1.06 KB
/
GiscusComments.tsx
File metadata and controls
43 lines (38 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"use client";
import Giscus from "@giscus/react";
interface GiscusCommentsProps {
className?: string;
docId?: string | null;
title?: string | null;
}
export function GiscusComments({
className,
docId,
title,
}: GiscusCommentsProps) {
const normalizedDocId = typeof docId === "string" ? docId.trim() : "";
const normalizedTitle = typeof title === "string" ? title.trim() : "";
const useSpecificMapping = normalizedDocId.length > 0;
const termValue = useSpecificMapping
? `${normalizedTitle || "Untitled"} | ${normalizedDocId}`
: undefined;
return (
<div className={className}>
<Giscus
repo="InvolutionHell/involutionhell.github.io"
repoId="R_kgDOPuD_8A"
category="Comments"
categoryId="DIC_kwDOPuD_8M4Cvip8"
mapping={useSpecificMapping ? "specific" : "pathname"}
term={termValue}
strict="0"
reactionsEnabled="1"
emitMetadata="0"
inputPosition="top"
theme="preferred_color_scheme"
lang="zh-CN"
loading="lazy"
/>
</div>
);
}