2023-12-15 09:55:09 +00:00
|
|
|
import React from 'react';
|
|
|
|
import {
|
|
|
|
default as ReactDropdown,
|
|
|
|
Option as ReactDropdownOption,
|
|
|
|
} from 'react-dropdown';
|
|
|
|
import 'react-dropdown/style.css';
|
|
|
|
|
|
|
|
interface Option {
|
|
|
|
value: string;
|
|
|
|
label: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DropdownProps {
|
|
|
|
options: Option[];
|
2023-12-18 11:28:17 +00:00
|
|
|
onChange: (arg: ReactDropdownOption) => void;
|
|
|
|
placeholder?: string;
|
|
|
|
value?: Option;
|
2023-12-15 09:55:09 +00:00
|
|
|
}
|
|
|
|
|
2023-12-18 11:28:17 +00:00
|
|
|
const Dropdown = ({ placeholder, options, onChange, value }: DropdownProps) => {
|
2023-12-15 09:55:09 +00:00
|
|
|
return (
|
|
|
|
<ReactDropdown
|
|
|
|
options={options}
|
|
|
|
placeholder={placeholder}
|
|
|
|
className="h-full"
|
|
|
|
controlClassName="h-full"
|
2023-12-18 11:28:17 +00:00
|
|
|
onChange={onChange}
|
|
|
|
value={value}
|
2023-12-15 09:55:09 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Dropdown;
|