import React, { useContext, useCallback } from 'react'; import { Sun, Moon } from 'lucide-react'; import { ThemeContext } from '~/hooks'; const Theme = ({ theme, onChange }: { theme: string; onChange: (value: string) => void }) => { const themeIcons = { system: , dark: , light: , }; return (
onChange(theme === 'dark' ? 'light' : 'dark')}> {themeIcons[theme]}
); }; const ThemeSelector = () => { const { theme, setTheme } = useContext(ThemeContext); const changeTheme = useCallback( (value: string) => { setTheme(value); }, [setTheme], ); return (
); }; export default ThemeSelector;