Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add feature: Add eye button in password section #201 #202

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 112 additions & 57 deletions site/components/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,124 @@
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useEffect, useState } from "react";
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

const NavBar = () => {
const router = useRouter()
const router = useRouter();
const currentRoute = router.pathname;
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);

const toggleMobileMenu = () => {
setMobileMenuOpen(!mobileMenuOpen);
};
useEffect(()=>{

useEffect(() => {
setMobileMenuOpen(false);
}, [router.asPath])
}, [router.asPath]);

return (
<>
<nav className="bg-white border-gray-200 dark:bg-gray-900">
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<Link href="/" className="flex items-center">
<img src="/images/favicon.ico" className="h-8 mr-3" alt="Company Logo" />
<span className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">Biotree</span>
</Link>
<button onClick={toggleMobileMenu} data-collapse-toggle="navbar-default" type="button" className="inline-flex items-center p-2 ml-3 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-default" aria-expanded="false">
<span className="sr-only">Open main menu</span>
<svg className="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clipRule="evenodd"></path></svg>
</button>
<div className={`${mobileMenuOpen ? "" : "hidden"} w-full md:block md:w-auto focus:outline-none`} id="navbar-default">
<ul className="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">

<li >
<Link href="/" className={`w-[70px] justify-center text-center rounded-full hover:text-pink-400 hover:bg-green-400 block py-2 pl-3 pr-4 ${currentRoute === '/' ? ' text-red-500 ' : 'text-green-500 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700 transition-all transform hover:scale-105 hover:shadow-2xl duration-300 ease-in-out cursor-default '}`}>Home</Link>
</li>
<li>
<Link href="/apply" className={`block py-2 w-[70px] justify-center text-center rounded-full hover:text-pink-400 hover:bg-green-400 pl-3 pr-4 ${currentRoute === '/apply' ? ' text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500' : 'text-gray-900 transition-all transform hover:scale-105 hover:shadow-2xl duration-300 ease-in-out text-green-500 cursor-default dark:text-white '}`}>Apply</Link>
</li>
<li>
<Link href="/login" className={`block py-2 pl-3 pr-4 w-[70px] justify-center text-center rounded-full hover:text-pink-400 hover:bg-green-400 ${currentRoute === '/login' ? ' text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500' : 'text-gray-900 transition-all transform hover:scale-105 hover:shadow-2xl duration-300 ease-in-out cursor-default text-green-500 '}`}>Login</Link>
</li>
<li>
<Link href="/dashboard" className={`block py-2 pl-3 pr-4 ${currentRoute === '/dashboard' ? ' text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500' : ' w-full transition-all transform hover:scale-105 hover:shadow-2xl duration-300 ease-in-out cursor-default justify-center text-center rounded-full hover:text-pink-400 hover:bg-green-400 text-green-500 '}`}>Dashboard</Link>

<li>
<Link href="/" className={`block py-2 pl-3 pr-4 rounded md:p-0 ${currentRoute === '/' ? 'text-blue-700 bg-blue-700 md:bg-transparent dark:text-blue-500' : 'text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700'}`}>Home</Link>
</li>
<li>
<Link href="/apply" className={`block py-2 pl-3 pr-4 rounded md:p-0 ${currentRoute === '/apply' ? 'text-blue-700 bg-blue-700 md:bg-transparent dark:text-blue-500' : 'text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700'}`}>Apply</Link>
</li>

<li>
<Link href="/dashboard" className={`block py-2 pl-3 pr-4 rounded md:p-0 ${currentRoute === '/dashboard' ? 'text-blue-700 bg-blue-700 md:bg-transparent dark:text-blue-500' : 'text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700'}`}>Dashboard</Link>

</li>
<li>
<Link href="/contact" className={`block py-2 pl-3 pr-4 ${currentRoute === '/contact' ? ' text-red-500 md:bg-transparent dark:text-blue-500' : ' w-full transition-all transform hover:scale-105 hover:shadow-2xl duration-300 ease-in-out cursor-default justify-center text-center rounded-full hover:text-pink-400 hover:bg-green-400 text-green-500 '}`}>Contact Us</Link>
</li>
<li>
<Link href="/login" className={`block py-2 pl-3 pr-4 rounded md:p-0 ${currentRoute === '/login' ? 'text-blue-700 bg-blue-700 md:bg-transparent dark:text-blue-500' : 'text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700'}`}>Login</Link>
</li>
</ul>
</div>
</div>
</nav>
</>
)
}
<>
<nav className="bg-white border-gray-200 dark:bg-gray-900">
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<Link href="/" className="flex items-center">
<img src="/images/favicon.ico" className="h-8 mr-3" alt="Company Logo" />
<span className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">
Biotree
</span>
</Link>
<button
onClick={toggleMobileMenu}
type="button"
className="inline-flex items-center p-2 ml-3 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
aria-controls="navbar-default"
aria-expanded={mobileMenuOpen}
>
<span className="sr-only">Open main menu</span>
<svg
className="w-6 h-6"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
clipRule="evenodd"
></path>
</svg>
</button>
<div
className={`${
mobileMenuOpen ? '' : 'hidden'
} w-full md:block md:w-auto focus:outline-none`}
id="navbar-default"
>
<ul className="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li>
<Link
href="/"
className={`w-[70px] justify-center text-center rounded-full hover:text-white hover:bg-green-400 block py-2 pl-3 pr-4 ${
currentRoute === '/'
? 'text-red-500'
: 'text-green-500 dark:text-white'
}`}
>
Home
</Link>
</li>
<li>
<Link
href="/apply"
className={`w-[70px] justify-center text-center rounded-full hover:text-white hover:bg-green-400 block py-2 pl-3 pr-4 ${
currentRoute === '/apply'
? 'text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500'
: 'text-green-500 dark:text-white'
}`}
>
Apply
</Link>
</li>
<li>
<Link
href="/login"
className={`w-[70px] justify-center text-center rounded-full hover:text-white hover:bg-green-400 block py-2 pl-3 pr-4 ${
currentRoute === '/login'
? 'text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500'
: 'text-green-500 dark:text-white'
}`}
>
Login
</Link>
</li>
<li>
<Link
href="/dashboard"
className={`w-[100%] justify-center text-center rounded-full hover:text-white hover:bg-green-400 block py-2 pl-3 pr-4 ${
currentRoute === '/dashboard'
? 'text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500'
: 'text-green-500 dark:text-white'
}`}
>
Dashboard
</Link>
</li>
<li>
<Link
href="/contact"
className={`w-[100%] justify-center text-center rounded-full hover:text-white hover:bg-green-400 block py-2 pl-3 pr-4 ${
currentRoute === '/contact'
? 'text-red-500 bg-blue-700 md:bg-transparent dark:text-blue-500'
: 'text-green-500 dark:text-white'
}`}
>
Contact Us
</Link>
</li>
</ul>
</div>
</div>
</nav>
</>
);
};

export default NavBar
export default NavBar;
10 changes: 3 additions & 7 deletions site/pages/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const Contact = () => {

const handleRequestCall = (e) => {
e.preventDefault();
// Handle form submission logic here
toast.success('Request for a call submitted!');
setFirstName('');
setLastName('');
Expand All @@ -25,7 +24,6 @@ const Contact = () => {

const handleFeedbackSubmit = (e) => {
e.preventDefault();
// Handle feedback submission logic here
toast.success('Feedback submitted!');
setFeedback(''); // Clear feedback input
};
Expand All @@ -35,9 +33,8 @@ const Contact = () => {
<h2 className="text-2xl font-bold text-center mb-6">
How would you like to contact Bio-branch?
</h2>
<div className="flex justify-center gap-6"> {/* Center the boxes with gap */}
{/* Request a Call Box */}
<div className={`${styles.box} w-1/3 p-4`}>
<div className="flex flex-col md:flex-row flex-wrap justify-center gap-6">
<div className={`${styles.box} w-full md:w-1/3 p-4`}>
<h3 className="font-semibold text-xl mb-4">Request a Call</h3>
<form onSubmit={handleRequestCall} className="flex flex-col gap-4">
<input
Expand Down Expand Up @@ -93,8 +90,7 @@ const Contact = () => {
</form>
</div>

{/* Support and Feedback Box */}
<div className="w-1/3 flex flex-col gap-4">
<div className="w-full md:w-1/3 flex flex-col gap-4">
<div className={`${styles.box} p-7 mb-5`}>
<h3 className="font-semibold text-xl mb-4">Support</h3>
<p>Phone: (123) 456-7890</p>
Expand Down
9 changes: 7 additions & 2 deletions site/pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ const Login = () => {
.catch(error => toast.error("An error occurred. Please try again."));

}

const [show,setShow]=useState(false)
const handleLockIcon=()=>{
setShow(!show)
}
return (
<>
<section className={styles.background + " min-h-screen flex justify-center items-center"}>
Expand All @@ -49,8 +54,8 @@ const Login = () => {
<input className='px-3 rounded-md focus:outline-none' placeholder='Add Email' type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
</span>
<span className='flex items-center shadow-md border-2 px-3 py-2 rounded-md focus:outline-none'>
<img className='w-7 mr-2' src="/svg/password.png" alt="" />
<input className='px-3 rounded-md focus:outline-none' placeholder='Add Password' type="password" value={password} onChange={(e) => setPassword(e.target.value)} required/>
<img className='w-7 mr-2' onClick={()=>handleLockIcon()} src={show ? "/svg/view.png":"/svg/hide.png"} alt="" />
<input className='px-3 rounded-md focus:outline-none' placeholder='Add Password' type={show ?"text":"password"} value={password} onChange={(e) => setPassword(e.target.value)} required/>
</span>

<input type='submit' value='Login' className='bg-blue-500 text-white px-3 py-2 rounded-md' />
Expand Down
4 changes: 4 additions & 0 deletions site/public/svg/eye-slash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions site/public/svg/eye.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/svg/hide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/svg/view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.