2024-04-16 21:18:08 +01:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { useTheme } from "next-themes";
|
|
|
|
import { MoonIcon } from "./icon/moon-icon";
|
|
|
|
import { SunIcon } from "./icon/sun-icon";
|
|
|
|
|
|
|
|
export function ToggleThemeButton(): JSX.Element {
|
|
|
|
const { theme, setTheme } = useTheme();
|
|
|
|
|
|
|
|
return (
|
2024-04-17 18:38:18 +01:00
|
|
|
<button
|
|
|
|
className="p-2 rounded-lg"
|
|
|
|
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
|
|
|
aria-label="Toggle Theme"
|
|
|
|
>
|
2024-04-16 21:18:08 +01:00
|
|
|
{theme === "dark" ? <SunIcon /> : <MoonIcon color="#000" />}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|