Skip to content
Snippets Groups Projects
Verified Commit b6beb5aa authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Move

parent 8af905dd
No related branches found
No related tags found
1 merge request!22Remove react-intl due failing tests
import React, { FC } from 'react';
import { TextField } from '@material-ui/core';
import { Control, Controller, FieldValues } from 'react-hook-form';
type Props = {
/**
* Name of the elemement. ex. email, password
*/
name: string;
label: string;
error: boolean;
errorMessage: string;
/**
* react-hook-form control
*/
control: Control<FieldValues> | undefined;
rules: Partial<unknown>;
};
export const InputField: FC<Props> = (props: Props) => {
const { name, label, error, errorMessage, control, rules } = props;
return (
<Controller
name={name}
control={control}
rules={rules}
render={({ onChange, value }) => (
<TextField
variant="outlined"
margin="normal"
required
fullWidth
id={name}
label={label}
name={name}
onChange={onChange}
value={value}
autoComplete={name}
autoFocus
error={error}
helperText={error && errorMessage}
/>
)}
/>
);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment