29 lines
516 B
TypeScript
29 lines
516 B
TypeScript
interface IOption {
|
|
id: string;
|
|
value: string;
|
|
}
|
|
|
|
interface ISelectProps<T extends IOption>
|
|
extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
multiple?: boolean;
|
|
options: T[];
|
|
selected?: T;
|
|
// onClose: () => void;
|
|
}
|
|
|
|
export default function Select<T extends IOption>({
|
|
multiple,
|
|
options,
|
|
selected,
|
|
onClose,
|
|
...props
|
|
}: ISelectProps<T>) {
|
|
return (
|
|
<select {...props}>
|
|
{options.map(({ id, value }) => (
|
|
<option key={id}>{value}</option>
|
|
))}
|
|
</select>
|
|
);
|
|
}
|