import { useTranslation } from 'react-i18next' import { Monitor, Moon, Sun } from 'lucide-react' import { useTheme, type ThemePreference } from '@/stores/ThemeProvider' import { cn } from '@/lib/utils' /** * Tri-state theme switch: Light / Dark / System. * *
Segmented control с тремя иконками. Активный — `--color-accent` * background + `--color-on-accent` foreground. Click меняет `preference` * в {@link ThemeProvider}, который пишет в localStorage и переключает * `data-theme` на html. * *
System icon показывает «follow OS» — auto-update при OS theme change. */ export function ThemeSwitch() { const { t } = useTranslation() const { preference, setPreference } = useTheme() const items: { id: ThemePreference; label: string; icon: typeof Sun }[] = [ { id: 'light', label: t('theme.light'), icon: Sun }, { id: 'dark', label: t('theme.dark'), icon: Moon }, { id: 'system', label: t('theme.system'), icon: Monitor }, ] return (