import { ChevronsUpDown, Monitor, Moon, Sun } from "lucide-react"; import { useTranslation } from 'react-i18next'; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { useTheme } from "@/hooks/useTheme"; import { type Theme } from "@/contexts/AppContext"; export function ThemePicker() { const { t } = useTranslation(); const { theme, setTheme } = useTheme(); const themeOptions: { value: Theme; label: string; icon: React.ComponentType<{ className?: string }> }[] = [ { value: "system", label: t('system'), icon: Monitor }, { value: "light", label: t('light'), icon: Sun }, { value: "dark", label: t('dark'), icon: Moon }, ]; const currentTheme = themeOptions.find(option => option.value === theme); const CurrentIcon = currentTheme?.icon || Monitor; return ( {themeOptions.map((option) => { const Icon = option.icon; return ( setTheme(option.value)} className="flex items-center gap-2" > {option.label} {theme === option.value && (
)} ); })} ); }