diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index 4d249fec..fde032b6 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -1,11 +1,15 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { IoEye } from 'react-icons/io5'; +import { IoMdEyeOff } from 'react-icons/io'; import { useNavigate } from 'react-router-dom'; export default function Signup() { const [showalert, setshowalert] = useState(''); const [email, setemail] = useState(''); const [password, setpassword] = useState(''); + const [isVisible, setisVisible] = useState(false); + const [ispasswordVisible, setispasswordVisible] = useState(false); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -29,6 +33,27 @@ export default function Signup() { const navigate = useNavigate(); + // Toogle Password + + const togglePassword = () => { + setispasswordVisible(!ispasswordVisible); + + const el = document.getElementById('password') as HTMLInputElement; + if (el.type === 'password') { + el.type = 'text'; + } else { + el.type = 'password'; + } + }; + + useEffect(() => { + if (password) { + setisVisible(true); + } else { + setisVisible(false); + } + }, [password]); + return (
@@ -57,15 +82,37 @@ export default function Signup() { }} className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" /> - { - setpassword(e.target.value); - }} - className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" - /> +
+ { + setpassword(e.target.value); + }} + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" + // onChange={onchange} + /> + {isVisible && + (!ispasswordVisible ? ( + + ) : ( + + ))} +