import { ChangeEvent, ForwardedRef, forwardRef, ReactElement, SetStateAction, } from 'react'; import styles from './Field.module.scss'; type FieldType = 'email' | 'number' | 'search' | 'select' | 'text' | 'textarea'; type SelectOptions = { id: string; name: string; value: string; }; const Field = ( { id, name, value, setValue, required = false, kind = 'text', label, options, }: { id: string; name: string; value: string; setValue: (value: SetStateAction) => void; required?: boolean; kind?: FieldType; label?: ReactElement; options?: SelectOptions[]; }, ref: ForwardedRef ) => { const updateValue = ( e: ChangeEvent ) => { setValue(e.target.value); }; const getOptions = () => { return options ? options.map((option) => ( )) : ''; }; const getField = () => { switch (kind) { case 'select': return ( ); case 'textarea': return (