2022-05-16 19:44:42 +03:00

28 lines
600 B
TypeScript

import type { InputProps } from 'antd';
import { Form, Input } from 'antd';
import type { BaseElementProps } from './types';
const { Item: FormItem } = Form;
export default function Element({
value,
setValue,
status,
isValid,
help,
...props
}: BaseElementProps<string>) {
return (
<FormItem hasFeedback validateStatus={isValid === false ? 'error' : ''} help={help}>
<Input
defaultValue={value}
onChange={(e) => setValue(e.target.value)}
disabled={status === 'Disabled'}
{...props}
/>
</FormItem>
);
}
export type { InputProps };