"use client"; import { cn } from "@/lib/utils"; import { Laptop, Moon, Sun } from "lucide-react"; import { useTheme } from "next-themes"; import type * as React from "react"; import { useEffect, useState } from "react"; export function ThemeToggle({ className, ...props }: React.ComponentProps<"div">) { const { setTheme, theme } = useTheme(); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); if (!mounted) { return (
*]:flex [&>*]:flex-1 [&>*]:items-center [&>*]:justify-center [&>*]:bg-background [&>*]:p-4", className, )} {...props} >
); } return (
*]:flex [&>*]:flex-1 [&>*]:items-center [&>*]:justify-center [&>*]:bg-background [&>*]:p-4 [&>*]:hover:bg-muted [&>*]:data-[active=true]:bg-muted", className, )} {...props} >
); }