import { Moon, Sun } from 'lucide-react'; import { useThemeStore } from '../store/themeStore'; import { Button } from './ui/button'; import { useEffect } from 'react'; export function ThemeToggle() { const { theme, toggleTheme } = useThemeStore(); // Ensure the theme class is applied correctly on mount in case hydration doesn't match the DOM useEffect(() => { if (theme === 'dark') { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark'); } }, [theme]); return ( ); }