mirror of
https://github.com/rjNemo/melon_frontend
synced 2026-06-10 20:36:42 +00:00
32 lines
617 B
TypeScript
32 lines
617 B
TypeScript
import { Form, Input } from 'antd';
|
|
import { Controller } from 'react-hook-form';
|
|
|
|
type FormInputProps = {
|
|
control: any;
|
|
name: string;
|
|
label: string;
|
|
placeholder?: string;
|
|
addonAfter?: string;
|
|
type?: string;
|
|
};
|
|
|
|
export function FormInput({
|
|
control,
|
|
name,
|
|
label,
|
|
placeholder,
|
|
addonAfter,
|
|
type = 'text'
|
|
}: FormInputProps) {
|
|
return (
|
|
<Controller
|
|
control={control}
|
|
name={name}
|
|
render={({ field }) => (
|
|
<Form.Item label={label}>
|
|
<Input placeholder={placeholder} {...field} addonAfter={addonAfter} type={type} />
|
|
</Form.Item>
|
|
)}
|
|
/>
|
|
);
|
|
}
|