2023-03-29 10:07:34 +03:00

28 lines
684 B
TypeScript

import type { BaseElementProps } from './types';
import type { InputProps } from 'antd';
import { Form, Input as AntInput } from 'antd';
import type { ChangeEvent, FC } from 'react';
const { Item: FormItem } = Form;
function Input({
value,
setValue,
status,
validateStatus,
help,
...props
}: BaseElementProps<string>) {
function handleChange(event: ChangeEvent<HTMLInputElement>) {
setValue(event.target.value);
}
return (
<FormItem hasFeedback help={help} validateStatus={validateStatus}>
<AntInput disabled={status === 'Disabled'} onChange={handleChange} value={value} {...props} />
</FormItem>
);
}
export default Input as FC<InputProps>;