ui / src /components /ThemeToggle.tsx
ZuhairAhmed's picture
downgrade to next 14, theme handling using next-themes and made used of app api router
9f43bd2
Raw
History Blame Contribute Delete
433 Bytes
"use client";
import { useTheme } from "next-themes";
import { Moon, Sun } from "lucide-react";
import { Button } from "@/components/ui/button";
export default function ThemeToggle() {
const { theme, setTheme } = useTheme();
return (
<Button
variant="ghost"
size="icon"
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
>
{theme === "dark" ? <Sun /> : <Moon />}
</Button>
);
}