mirror of
https://github.com/rjNemo/melon_frontend
synced 2026-06-06 02:16:45 +00:00
* chore: update deps to fix CVEs * cleanup * use variable for app routes * refactor * ⬆️ react router * ⬆️ react * delete pem files
34 lines
831 B
TypeScript
34 lines
831 B
TypeScript
import { Form, Select } from 'antd';
|
|
import { Controller } from 'react-hook-form';
|
|
|
|
type InputSelectProps = {
|
|
control: any;
|
|
name: string;
|
|
label: string;
|
|
placeholder: string;
|
|
options: string[];
|
|
};
|
|
|
|
export const InputSelect = ({ control, name, label, placeholder, options }: InputSelectProps) => (
|
|
<Controller
|
|
control={control}
|
|
name={name}
|
|
render={({ field }) => (
|
|
<Form.Item label={label}>
|
|
<Select
|
|
showSearch
|
|
placeholder={placeholder}
|
|
optionFilterProp="children"
|
|
filterOption={(input, option) =>
|
|
option?.label!.toLowerCase().indexOf(input.toLowerCase())! >= 0
|
|
}
|
|
options={options.map((label, value) => ({
|
|
value,
|
|
label
|
|
}))}
|
|
{...field}
|
|
/>
|
|
</Form.Item>
|
|
)}
|
|
/>
|
|
);
|