import React from 'react'; import CheckMark from '../svg/CheckMark'; import { Listbox, Transition } from '@headlessui/react'; import { cn } from '~/utils/'; import { useLocalize } from '~/hooks'; type SelectDropDownProps = { id?: string; title?: string; value: string; disabled?: boolean; setValue: (value: string) => void; availableValues: string[]; showAbove?: boolean; showLabel?: boolean; containerClassName?: string; subContainerClassName?: string; className?: string; }; function SelectDropDown({ title, value, disabled, setValue, availableValues, showAbove = false, showLabel = true, containerClassName, subContainerClassName, className, }: SelectDropDownProps) { const localize = useLocalize(); const transitionProps = { className: 'top-full mt-3' }; if (showAbove) { transitionProps.className = 'bottom-full mb-3'; } if (!title) { title = localize('com_ui_model'); } return (
{({ open }) => ( <> {' '} {showLabel && ( {title} )} {!showLabel && ( {title}: )} {value} {availableValues.map((option: string, i: number) => ( {option} {option === value && ( )} ))} )}
); } export default SelectDropDown;