Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import React from "react"; import DropdownOptions from "../../common/DropdownOptions/index.tsx"; import DropdownTitle from "../../common/DropdownTitle/index.tsx"; import useDropdown from "../../../hooks/common/useDropdown.ts"; type DropdownInputType = { value: string; handleChange: (val: string) => void; options: any[]; label?: string; placeholder?: string; error?: string; disabled?: boolean; }; function DropdownInput({ handleChange, options, value, disabled, error, ...props }: DropdownInputType) { const { dropdownRef, handleSelect, isOpen, toggle } = useDropdown(handleChange); const selectedValue = value ? options.find((e) => e.id === value)?.label : ""; return ( <div ref={dropdownRef} className="relative w-fit inline-block text-left"> <DropdownTitle {...props} toggle={toggle} value={selectedValue} showIcon={true} inputDisabed={true} isOpen={isOpen} disabled={disabled} error={!!error} className={`!min-w-[100px] pointer-events-none`} /> {isOpen && !disabled && ( <DropdownOptions options={options} handleSelect={handleSelect} /> )} </div> ); } export default DropdownInput; |