"use client"; import * as React from "react"; import { useTheme } from "next-themes"; import { Moon, Sun } from "lucide-react"; import { cn } from "@/lib/utils"; const subscribe = () => () => {}; export function ThemeToggle({ className }: { className?: string }) { const { resolvedTheme, setTheme } = useTheme(); // Avoid a hydration mismatch: the resolved theme is only known on the client. const mounted = React.useSyncExternalStore( subscribe, () => true, () => false, ); const isDark = mounted && resolvedTheme === "dark"; return ( ); }