28 lines
593 B
TypeScript
28 lines
593 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
|
|
value={value}
|
|
onChange={(e) => setValue(e.target.value)}
|
|
disabled={status === 'Disabled'}
|
|
{...props}
|
|
/>
|
|
</FormItem>
|
|
);
|
|
}
|
|
|
|
export type { InputProps };
|