import * as React from 'react'; import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'; import { Sun, Moon } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useTheme } from '@/contexts/ThemeContext'; /* ── Radix DropdownMenu thin wrappers ──────────────────────── */ const DropdownMenu = DropdownMenuPrimitive.Root; const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 6, ...props }, ref) => ( )); DropdownMenuContent.displayName = 'DropdownMenuContent'; const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => ( )); DropdownMenuItem.displayName = 'DropdownMenuItem'; /* ── Theme options config ───────────────────────────────────── */ const THEMES = [ { value: 'light', label: 'Light', Icon: Sun }, { value: 'dark', label: 'Dark', Icon: Moon }, ]; /* ── ThemeToggle ────────────────────────────────────────────── */ export function ThemeToggle({ className }) { 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} ))} ); }