1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-01 11:06:37 -04:00

use new giscus options

This commit is contained in:
2022-11-07 08:38:02 -05:00
parent 775b5efef4
commit f51d48f622
4 changed files with 139 additions and 121 deletions

View File

@ -1,3 +1,4 @@
import clsx from "clsx";
import Giscus from "@giscus/react";
import useTheme from "../../hooks/useTheme";
import { styled, theme } from "../../lib/styles/stitches.config";
@ -16,18 +17,24 @@ export type CommentsProps = ComponentProps<typeof Wrapper> & {
title: string;
};
const Comments = ({ title, ...rest }: CommentsProps) => {
const Comments = ({ title, className, ...rest }: CommentsProps) => {
const { activeTheme } = useTheme();
// TODO: use custom `<Loading />` spinner component during suspense
return (
<Wrapper {...rest}>
<Wrapper
id="comments"
className={clsx([className, "giscus"])} // https://github.com/giscus/giscus/blob/fa0975c980d91e691e7e4b4f59fd10bec2e20d90/client.ts#L81
{...rest}
>
<Giscus
{...(giscusConfig as GiscusProps)}
term={title}
mapping="specific"
reactionsEnabled="1"
emitMetadata="0"
inputPosition="top"
loading="eager" // still lazily loaded with react-intersection-observer
theme={activeTheme === "dark" ? activeTheme : "light"}
/>
</Wrapper>