From d1f9f97fe843a3a24242b3ffa397b8ff84cda262 Mon Sep 17 00:00:00 2001 From: xfy Date: Wed, 22 May 2024 13:53:12 +0800 Subject: [PATCH] fix commnet theme --- components/post/post-comment.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/post/post-comment.tsx b/components/post/post-comment.tsx index 0cdc33a..877ab6b 100644 --- a/components/post/post-comment.tsx +++ b/components/post/post-comment.tsx @@ -1,12 +1,13 @@ 'use client'; import Giscus from '@giscus/react'; -import { useTheme } from 'next-themes'; +import { THEME_CATPUCCIN_MAP } from 'lib/consts'; +import useRuaTheme from 'lib/hooks/use-rua-theme'; import { memo } from 'react'; const PostComment = () => { - const { systemTheme, theme } = useTheme(); - const currentTheme = theme === 'system' ? systemTheme : theme; + const { theme } = useRuaTheme(); + console.log('PostComment', theme); return ( <> @@ -18,7 +19,13 @@ const PostComment = () => { mapping="pathname" reactionsEnabled="1" emitMetadata="0" - theme={currentTheme === 'dark' ? 'dark_dimmed' : 'light'} + theme={ + THEME_CATPUCCIN_MAP[ + (theme ?? 'latte') as keyof typeof THEME_CATPUCCIN_MAP + ] === 'dark' + ? 'noborder_gray' + : 'noborder_light' + } loading="lazy" inputPosition="top" />