ThemeSwitcher.tsx 533 B

1234567891011121314151617181920
  1. import { Moon, Sun } from 'lucide-react';
  2. import { useTheme } from '@/contexts/ThemeContext';
  3. export default function ThemeSwitcher() {
  4. const { theme, toggleTheme } = useTheme();
  5. return (
  6. <button
  7. onClick={toggleTheme}
  8. className="p-2 rounded-md transition-colors hover:bg-gray-100"
  9. title={theme === 'light' ? 'Switch to dark mode' : 'Switch to light mode'}
  10. >
  11. {theme === 'light' ? (
  12. <Moon className="h-5 w-5" />
  13. ) : (
  14. <Sun className="h-5 w-5" />
  15. )}
  16. </button>
  17. );
  18. }