From c2211eae6bd9b79d57891d206e6bab47e124c66e Mon Sep 17 00:00:00 2001 From: Aron Yang Date: Tue, 6 May 2025 12:04:57 +0800 Subject: [PATCH 1/3] Fix typo in appearance property in ThemeProvider --- contexts/theme.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contexts/theme.tsx b/contexts/theme.tsx index 6e43513..2878828 100644 --- a/contexts/theme.tsx +++ b/contexts/theme.tsx @@ -17,7 +17,7 @@ const ThemeContext = createContext(undefined as any) export function ThemeProvider ({ children }: BasicProps) { const config = useConfig() - const [theme, setTheme] = useState(config.appearance === 'auto' ? 'system' : config.appearnce) + const [theme, setTheme] = useState(config.appearance === 'auto' ? 'system' : config.appearance) const [prefersDark, setPrefersDark] = useState() From f5cb5d21c96611e71bd29e79d2ed3db8d3980a82 Mon Sep 17 00:00:00 2001 From: Aron Yang Date: Tue, 6 May 2025 16:53:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=90=9B=20make=20Cusdis=20follow=20res?= =?UTF-8?q?olved=20light/dark=20scheme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/comments/cusdis.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/comments/cusdis.jsx b/components/comments/cusdis.jsx index f82be22..de4987d 100644 --- a/components/comments/cusdis.jsx +++ b/components/comments/cusdis.jsx @@ -1,18 +1,21 @@ import { ReactCusdis } from 'react-cusdis' import { useRouter } from 'next/router' import { useConfig } from '@/contexts/config' +import { useTheme } from "@/contexts/theme"; export default function Cusdis ({ config, post }) { const router = useRouter() - const { link, lang, appearance } = useConfig() + const { link, lang } = useConfig() + const { scheme } = useTheme() return ( Date: Fri, 9 May 2025 20:26:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20correct=20`auto`=20ap?= =?UTF-8?q?pearance=20behavior=20for=20utterances=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/comments/utterances.jsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/components/comments/utterances.jsx b/components/comments/utterances.jsx index a207626..a3ba0cd 100644 --- a/components/comments/utterances.jsx +++ b/components/comments/utterances.jsx @@ -1,13 +1,10 @@ import { useEffect, useRef } from 'react' -import { useConfig } from '@/contexts/config' +import { useTheme } from '@/contexts/theme' export default function Utterances ({ config, post }) { - const { appearance } = useConfig() - const theme = { - auto: 'preferred-color-scheme', - light: 'github-light', - dark: 'github-dark', - }[appearance] + const { scheme } = useTheme() + + const theme = scheme === 'dark' ? 'github-dark' : 'github-light' const container = useRef()