Use easy-peasy to store file state data

This commit is contained in:
Dane Everitt 2019-08-04 14:58:31 -07:00
parent 918e0e2947
commit 5f59210c85
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
11 changed files with 110 additions and 34 deletions

View file

@ -8,10 +8,11 @@ interface Props {
name: string;
label?: string;
description?: string;
autoFocus?: boolean;
validate?: (value: any) => undefined | string | Promise<any>;
}
export default ({ id, type, name, label, description, validate }: Props) => (
export default ({ id, type, name, label, description, autoFocus, validate }: Props) => (
<Field name={name} validate={validate}>
{
({ field, form: { errors, touched } }: FieldProps) => (
@ -23,6 +24,7 @@ export default ({ id, type, name, label, description, validate }: Props) => (
id={id}
type={type}
{...field}
autoFocus={autoFocus}
className={classNames('input-dark', {
error: touched[field.name] && errors[field.name],
})}