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(); if (email.length === 0 || password.length === 0) { setshowalert('Both fields are required'); return; } //email validation if (!email.match(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)) { setshowalert('Please enter a valid email address'); return; } setshowalert(''); alert('Signup Successful '); navigate('/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 (
navigate('/')}> Logo

Create

DocsGPT

Account

{ setemail(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 ? ( ) : ( ))}
{showalert.length > 0 && (
{showalert}
)}

Already have an account?

navigate('/login')} > Log in

); }