Girish Jeswani
add theme context
fdb1a43
Raw
History Blame Contribute Delete
541 Bytes
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;