From bf9cd2b24877dce14874d4d8fe7037edf7d50911 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Sun, 26 Nov 2023 15:25:52 +0100 Subject: [PATCH] fix: language selector in settings --- .../client/src/components/locale-combobox.tsx | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/apps/client/src/components/locale-combobox.tsx b/apps/client/src/components/locale-combobox.tsx index e9d6de14..57abb4c0 100644 --- a/apps/client/src/components/locale-combobox.tsx +++ b/apps/client/src/components/locale-combobox.tsx @@ -1,11 +1,15 @@ import { t } from "@lingui/macro"; -import { Check } from "@phosphor-icons/react"; +import { CaretDown, Check } from "@phosphor-icons/react"; import { + Button, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, + Popover, + PopoverContent, + PopoverTrigger, ScrollArea, } from "@reactive-resume/ui"; import { cn } from "@reactive-resume/utils"; @@ -69,3 +73,43 @@ export const LocaleCombobox = ({ value, onValueChange }: Props) => { ); }; + +export const LocaleComboboxPopover = ({ value, onValueChange }: Props) => { + const { languages } = useLanguages(); + const [open, setOpen] = useState(false); + + const selected = useMemo(() => { + return languages.find((lang) => lang.locale === value); + }, [value, languages]); + + const onSelect = (selectedValue: string) => { + onValueChange(selectedValue); + setOpen(false); + }; + + return ( + + + + + + + + + ); +};