2024-04-16 21:18:08 +01:00
|
|
|
"use client";
|
|
|
|
|
2024-04-18 03:51:41 +01:00
|
|
|
import { MoonIcon, SunIcon } from "@heroicons/react/16/solid";
|
2024-04-16 21:18:08 +01:00
|
|
|
import { useTheme } from "next-themes";
|
2024-04-18 03:51:41 +01:00
|
|
|
import { ReactElement } from "react";
|
2024-04-16 21:18:08 +01:00
|
|
|
|
2024-04-18 03:51:41 +01:00
|
|
|
export function ToggleThemeButton(): ReactElement {
|
2024-04-16 21:18:08 +01:00
|
|
|
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-18 03:51:41 +01:00
|
|
|
{theme === "dark" ? <SunIcon width={24} height={24} /> : <MoonIcon width={24} height={24} color="#000" />}
|
2024-04-16 21:18:08 +01:00
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|