import { forwardRef, useState } from 'react' import Link from 'next/link' import { ErrorMessage } from '../Authentication/ErrorMessage' import useTranslation from 'next-translate/useTranslation' interface InputProps extends React.ComponentPropsWithRef<'input'> { label: string errors?: string[] showForgotPassword?: boolean } export const Input = forwardRef((props, ref) => { const { label, name, type = 'text', errors = [], showForgotPassword = false, ...rest } = props const { t } = useTranslation() const [inputType, setInputType] = useState(type) const handlePassword = (): void => { const oppositeType = inputType === 'password' ? 'text' : 'password' setInputType(oppositeType) } return ( <>
{type === 'password' && showForgotPassword ? ( {t('authentication:forgot-password')} ) : null}
{type === 'password' && (
)}
) })