import { useState } from "react" import Link from "next/link" import useTranslation from "next-translate/useTranslation" import classNames from "clsx" import { FormState } from "../FormState" export interface InputProps extends React.ComponentPropsWithRef<"input"> { label: string error?: string | null showForgotPassword?: boolean className?: string } export const getInputType = (inputType: string): string => { return inputType === "password" ? "text" : "password" } export const Input: React.FC = (props) => { const { label, name, className, type = "text", showForgotPassword = false, error, ...rest } = props const { t } = useTranslation() const [inputType, setInputType] = useState(type) const handlePassword = (): void => { const oppositeType = getInputType(inputType) setInputType(oppositeType) } return (
{type === "password" && showForgotPassword ? ( {t("authentication:forgot-password")} ) : null}
{type === "password" && (
)}
) }