mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
scaffold create/edit beer form, scaffold beer page
This commit is contained in:
33
components/ui/forms/FormTextInput.tsx
Normal file
33
components/ui/forms/FormTextInput.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
/* eslint-disable react/require-default-props */
|
||||
import { FunctionComponent } from 'react';
|
||||
import { FieldError, UseFormRegisterReturn } from 'react-hook-form';
|
||||
|
||||
interface FormInputProps {
|
||||
placeholder?: string;
|
||||
formValidationSchema: UseFormRegisterReturn<string>;
|
||||
error: boolean;
|
||||
// eslint-disable-next-line react/require-default-props
|
||||
type: 'email' | 'password' | 'text' | 'date';
|
||||
id: string;
|
||||
height?: string;
|
||||
}
|
||||
|
||||
const FormTextInput: FunctionComponent<FormInputProps> = ({
|
||||
placeholder = '',
|
||||
formValidationSchema,
|
||||
error,
|
||||
type,
|
||||
id,
|
||||
}) => (
|
||||
<input
|
||||
id={id}
|
||||
type={type}
|
||||
placeholder={placeholder}
|
||||
className={`input w-full transition ease-in-out rounded-lg input-bordered ${
|
||||
error ? 'input-error' : ''
|
||||
}`}
|
||||
{...formValidationSchema}
|
||||
/>
|
||||
);
|
||||
|
||||
export default FormTextInput;
|
||||
Reference in New Issue
Block a user