'use client'; import React, { useEffect, useState } from 'react'; import { useTheme } from '../contexts/ThemeContext'; import { cn } from '../lib/utils'; interface ThemeToggleProps { className?: string; } const ThemeToggle: React.FC = ({ className }) => { const [mounted, setMounted] = useState(false); const { theme, toggleTheme } = useTheme(); // Only render after hydration to prevent SSR issues useEffect(() => { setMounted(true); }, []); if (!mounted) { // Return a placeholder that matches the final component size return (
); } return ( ); }; export default ThemeToggle;