import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; import { Sun, Moon, type LucideIcon } from 'lucide-react'; import type { ComponentProps } from 'react'; import { cn } from '@/lib/utils'; import { useTheme } from '@/contexts/ThemeContext'; /* ── Radix DropdownMenu thin wrappers ──────────────────────── */ const DropdownMenu = DropdownMenuPrimitive.Root; const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; function DropdownMenuContent({ className, sideOffset = 6, ref, ...props }: ComponentProps) { return ( ); } function DropdownMenuItem({ className, inset, ref, ...props }: ComponentProps & { inset?: boolean }) { return ( ); } /* ── Theme options config ───────────────────────────────────── */ interface ThemeOption { value: string; label: string; Icon: LucideIcon; } const THEMES: ThemeOption[] = [ { value: 'light', label: 'Light', Icon: Sun }, { value: 'dark', label: 'Dark', Icon: Moon }, ]; /* ── ThemeToggle ────────────────────────────────────────────── */ export function ThemeToggle({ className }: { className?: string }) { const { theme, setTheme } = useTheme(); const current = THEMES.find((t) => t.value === theme) ?? THEMES[1]!; const CurrentIcon = current.Icon; return ( {THEMES.map(({ value, label, Icon }) => ( setTheme(value)} className={cn( theme === value && 'text-primary font-medium' )} > {label} ))} ); }