// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import React from 'react'; import { WrappedFieldProps, WrappedFieldInputProps } from 'redux-form'; import { FormGroup, FormLabel, FormHelperText } from '@material-ui/core'; interface FormFieldCustomProps { children:

(props: WrappedFieldInputProps) => React.ReactElement

; label?: string; helperText?: string; required?: boolean; } export type FormFieldProps = FormFieldCustomProps & WrappedFieldProps; export const FormField = ({ children, ...props }: FormFieldProps & WrappedFieldProps) => { return ( {props.label} { children(props.input) } { props.meta.touched && props.meta.error ? props.meta.error : props.helperText } ); };