forked from vibeasite-templates/template-restaurant
19 lines
624 B
TypeScript
19 lines
624 B
TypeScript
import { useTheme } from "next-themes";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Sun, Moon } from "lucide-react";
|
|
|
|
export function ThemeToggle() {
|
|
const { theme, setTheme } = useTheme();
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
className="h-9 w-9"
|
|
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
|
aria-label="Toggle theme"
|
|
>
|
|
<Sun className="h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
|
<Moon className="absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
|
</Button>
|
|
);
|
|
} |