Spaces:
Sleeping
Sleeping
| import React from 'react'; | |
| import { Sun, Moon } from 'lucide-react'; | |
| import { useTheme } from '../contexts/ThemeContext'; | |
| const ThemeToggle = () => { | |
| const { theme, toggleTheme } = useTheme(); | |
| return ( | |
| <button | |
| onClick={toggleTheme} | |
| className="theme-toggle" | |
| aria-label={`Switch to ${theme === 'light' ? 'dark' : 'light'} theme`} | |
| > | |
| {theme === 'light' ? ( | |
| <Moon className="theme-icon" /> | |
| ) : ( | |
| <Sun className="theme-icon" /> | |
| )} | |
| </button> | |
| ); | |
| }; | |
| export default ThemeToggle; |