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

[Feat]: NavBar should close When Navitem is clicked in mobile devices #56

Merged
Merged
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
11 changes: 11 additions & 0 deletions client/src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ const Navbar = () => {
setIsOpen(!isOpen);
};

const closeMenu = () => {
setIsOpen(false);
};

return (
<nav className="bg-gray-800">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
Expand Down Expand Up @@ -94,36 +98,42 @@ const Navbar = () => {
<Link
to="/"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
onClick={closeMenu}
>
Home
</Link>
<Link
to="/data-info"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
onClick={closeMenu}
>
Data Info
</Link>
<Link
to="/prediction"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
onClick={closeMenu}
>
Prediction
</Link>
<Link
to="/visualization"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
onClick={closeMenu}
>
Visualization
</Link>
<Link
to="/contact"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
onClick={closeMenu}
>
Contact Us
</Link>
<Link
to="/FAQ"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium"
onClick={closeMenu}
>
FAQ
</Link>
Expand All @@ -132,6 +142,7 @@ const Navbar = () => {
target="_blank"
rel="noopener noreferrer"
className="text-gray-300 hover:bg-gray-700 hover:text-white block px-3 py-2 rounded-md text-base font-medium flex gap-2 items-center"
onClick={closeMenu}
>
<CiStar className="w-5 h-5 text-yellow-500 font-bold" />
<FaGithub className="h-5 w-5" />
Expand Down
Loading