fix theme toggle button
This commit is contained in:
parent
3be59f97c3
commit
a3e9411c97
@ -2,11 +2,20 @@
|
||||
|
||||
import { MoonIcon, SunIcon } from "@heroicons/react/16/solid";
|
||||
import { useTheme } from "next-themes";
|
||||
import { ReactElement } from "react";
|
||||
import { ReactElement, useEffect, useState } from "react";
|
||||
|
||||
export function ToggleThemeButton(): ReactElement {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const { theme, setTheme } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!mounted) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
className="rounded-lg"
|
||||
|
Loading…
x
Reference in New Issue
Block a user