diff --git a/pages/components/DarkmodeSwitcher.js b/pages/components/DarkmodeSwitcher.js index 53c16d8..f31489a 100644 --- a/pages/components/DarkmodeSwitcher.js +++ b/pages/components/DarkmodeSwitcher.js @@ -13,17 +13,27 @@ const Layout = (props) => { const { locale, locales, defaultLocale, pathname } = router const [isMounted, setIsMounted] = useState(false); - const { theme, setTheme } = useTheme(); -useEffect(() => { + const { theme, setTheme, getTheme } = useTheme(); + let moon = "🌙"; + useEffect(() => { setIsMounted(true); }, []); -const switchTheme = () => { + const switchTheme = () => { if (isMounted) { setTheme(theme === "light" ? "dark" : "light"); } + if (theme == "light") moon = "🌙"; + if (theme == "dark") moon = "🌅"; }; + console.log(theme); return ( - + ) } export default Layout \ No newline at end of file