"use client" import { Moon, Sun } from "lucide-react" import { useTheme } from "next-themes" import { useEffect, useState } from "react" export const ThemeToggle = () => { const { theme, setTheme } = useTheme() const [mounted, setMounted] = useState(false) // Ensure component is mounted to avoid hydration mismatch useEffect(() => { setMounted(true) }, []) if (!mounted) { return null } const toggleTheme = () => { if (theme === "dark") { setTheme("light") } else { setTheme("dark") } } return (