From b6b3e455dea8c486a35a7a17ade2e04ed18f874f Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Mon, 27 Nov 2023 18:15:28 +0530 Subject: [PATCH] Final_changes_maded --- frontend/package-lock.json | 9 ++++ frontend/package.json | 1 + frontend/src/Login/Login.tsx | 85 +++++++++++++++++++++++++++--------- 3 files changed, 75 insertions(+), 20 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0f72134d..9e9afa8b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,6 +14,7 @@ "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", + "react-icons": "^4.12.0", "react-markdown": "^8.0.7", "react-redux": "^8.0.5", "react-router-dom": "^6.8.1", @@ -6411,6 +6412,14 @@ "react": ">= 16.8 || 18.0.0" } }, + "node_modules/react-icons": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz", + "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index f67ed479..c43abf69 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -25,6 +25,7 @@ "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", + "react-icons": "^4.12.0", "react-markdown": "^8.0.7", "react-redux": "^8.0.5", "react-router-dom": "^6.8.1", diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index e885e5c8..5d036f6b 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -1,14 +1,16 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; +import { IoEye } from 'react-icons/io5'; +import { IoMdEyeOff } from 'react-icons/io'; export default function Login() { 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(); - + const handleSubmit = () => { //email validation if (email.length === 0 || password.length === 0) { if (password.length === 0) { @@ -59,6 +61,27 @@ export default function Login() { 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 (
@@ -73,10 +96,7 @@ export default function Login() { DocsGPT
-
+ -
- { - 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} - /> +
+ { + 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 ? ( + + ) : ( + + ))} +
+

navigate('/Forgot')} > Forgot your password?

- {showalert.length > 0 && (