import { useState } from "react"; import { Monitor, Moon, Sun } from "lucide-react"; import { getThemeChoice, setThemeChoice, type ThemeChoice } from "../theme"; const options: { value: ThemeChoice; label: string; icon: typeof Moon }[] = [ { value: "dark", label: "Dark", icon: Moon }, { value: "light", label: "Light", icon: Sun }, { value: "system", label: "System", icon: Monitor }, ]; // Dark / Light / System. `compact` shows icons only, for the sidebar. export function ThemeSwitch({ compact = false }: { compact?: boolean }) { const [choice, setChoice] = useState(getThemeChoice); const pick = (v: ThemeChoice) => { setThemeChoice(v); setChoice(v); }; return (
{options.map((o) => { const Icon = o.icon; return ( ); })}
); }