"use client"; import * as React from "react"; import { Moon, Sun, Monitor } from "lucide-react"; import { useTheme } from "next-themes"; import { useHydrated } from "@/hooks/useHydrated"; import { cn } from "@/lib/utils"; export function ThemeToggle({ className }: { className?: string }) { const { theme, setTheme } = useTheme(); const mounted = useHydrated(); if (!mounted) { return
; // Placeholder to avoid layout shift } const cycleTheme = () => { if (theme === "system") { setTheme("light"); } else if (theme === "light") { setTheme("dark"); } else { setTheme("system"); } }; return ( ); }