From 7e6f8b3b2fedf9b1840efa163f404196d7db633e Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sat, 29 Oct 2022 22:49:21 +0200 Subject: [PATCH] Use resolved theme --- components/Blog/ThemeSwitch.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Blog/ThemeSwitch.tsx b/components/Blog/ThemeSwitch.tsx index 7e70c45..de8d232 100644 --- a/components/Blog/ThemeSwitch.tsx +++ b/components/Blog/ThemeSwitch.tsx @@ -14,7 +14,7 @@ interface FadeProperties { const ThemeSwitch: NextPage<{ size?: string }> = ({ size }) => { const [mounted, setMounted] = useState(false); const [fadeProps, setFadeProps] = useState({}); - const { theme, setTheme } = useTheme(); + const { resolvedTheme, setTheme } = useTheme(); // Will be run when the component is rendered. useEffect(() => { @@ -40,8 +40,8 @@ const ThemeSwitch: NextPage<{ size?: string }> = ({ size }) => { ; } - const sunClasses = fadeProps.sun || (theme !== "light" ? styles.selected : undefined); - const moonClasses = fadeProps.moon || (theme === "light" ? styles.selected : undefined); + const sunClasses = fadeProps.sun || (resolvedTheme === "dark" ? styles.selected : undefined); + const moonClasses = fadeProps.moon || (resolvedTheme === "light" ? styles.selected : undefined); return
switchTheme("light")}>