zucchetti-sa5/themes/onepirate/modules/form/RFTextField.tsx
Arnaud Fauconnet 328a760eb8 added theme
2022-10-28 11:41:58 +02:00

34 lines
740 B
TypeScript

import * as React from 'react';
import { FieldRenderProps } from 'react-final-form';
import TextField, { OnePirateTextFieldProps } from '../components/TextField';
function RFTextField(
props: OnePirateTextFieldProps & FieldRenderProps<string, HTMLElement>,
) {
const {
autoComplete,
input,
InputProps,
meta: { touched, error, submitError },
...other
} = props;
return (
<TextField
error={Boolean(!!touched && (error || submitError))}
{...input}
{...other}
InputProps={{
inputProps: {
autoComplete,
},
...InputProps,
}}
helperText={touched ? error || submitError : ''}
variant="standard"
/>
);
}
export default RFTextField;