1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { WrappedFieldProps, WrappedFieldInputProps } from 'redux-form';
7 import { FormGroup, FormLabel, FormHelperText } from '@material-ui/core';
9 interface FormFieldCustomProps {
10 children: <P>(props: WrappedFieldInputProps) => React.ReactElement<P>;
16 export type FormFieldProps = FormFieldCustomProps & WrappedFieldProps;
18 export const FormField = ({ children, ...props }: FormFieldProps & WrappedFieldProps) => {
23 focused={props.meta.active}
24 required={props.required}
25 error={props.meta.touched && !!props.meta.error}>
29 { children(props.input) }
31 <FormHelperText error={props.meta.touched && !!props.meta.error}>
33 props.meta.touched && props.meta.error