diff --git a/components/auth/AuthForm.tsx b/components/auth/AuthForm.tsx index b1bbcb866a..c0316dcd4a 100644 --- a/components/auth/AuthForm.tsx +++ b/components/auth/AuthForm.tsx @@ -97,7 +97,6 @@ export const AuthForm = ({ type }: { type: string }) => {
{type === "sign-up" && ( @@ -115,6 +114,7 @@ export const AuthForm = ({ type }: { type: string }) => { type="text" label="Company Name" placeholder="Enter your company name" + isRequired={false} /> )} @@ -138,35 +138,17 @@ export const AuthForm = ({ type }: { type: string }) => { )} - {/* - {isConfirmVisible ? ( - - ) : ( - - )} - - } - label="Confirm Password" - name="confirmPassword" - placeholder="Confirm your password" - type={isConfirmVisible ? "text" : "password"} - variant="bordered" - /> */} {type === "sign-up" && ( ( <> + { type?: string; placeholder?: string; password?: boolean; + confirmPassword?: boolean; isRequired?: boolean; isInvalid?: boolean; } @@ -28,24 +29,53 @@ export const CustomInput = ({ labelPlacement = "inside", placeholder, variant = "bordered", + confirmPassword = false, password = false, isRequired = true, isInvalid, }: CustomInputProps) => { - const [isVisible, setIsVisible] = useState(false); + const [isPasswordVisible, setIsPasswordVisible] = useState(false); + const [isConfirmPasswordVisible, setIsConfirmPasswordVisible] = + useState(false); - const toggleVisibility = () => setIsVisible(!isVisible); + const inputLabel = confirmPassword + ? "Confirm Password" + : password + ? "Password" + : label; - const inputLabel = password ? "Password" : label; - const inputType = password ? (isVisible ? "text" : "password") : type; - const inputPlaceholder = password ? "Enter your password" : placeholder; - const inputIsRequired = password ? true : isRequired; + const inputPlaceholder = confirmPassword + ? "Confirm Password" + : password + ? "Password" + : placeholder; - const endContent = password && ( + const inputType = + password || confirmPassword + ? isPasswordVisible || isConfirmPasswordVisible + ? "text" + : "password" + : type; + const inputIsRequired = password || confirmPassword ? true : isRequired; + + const toggleVisibility = () => { + if (password) { + setIsPasswordVisible(!isPasswordVisible); + } else if (confirmPassword) { + setIsConfirmPasswordVisible(!isConfirmPasswordVisible); + } + }; + + const endContent = (password || confirmPassword) && ( );