From ca9514c1803ea2d00c3819668194a332c9269803 Mon Sep 17 00:00:00 2001 From: usmaan <2021.mohdusmaan.mogal@ves.ac.in> Date: Wed, 9 Oct 2024 00:33:23 +0530 Subject: [PATCH] Responsive Navbar --- src/app/components/Navbar.tsx | 113 ++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 34 deletions(-) diff --git a/src/app/components/Navbar.tsx b/src/app/components/Navbar.tsx index efc78bd..fd7a4fd 100644 --- a/src/app/components/Navbar.tsx +++ b/src/app/components/Navbar.tsx @@ -1,39 +1,84 @@ -import React from 'react' +import React, { useState } from 'react'; import Image from 'next/image'; -import Logo from '../public/Logo.png' -import '@/styles.css' +import Logo from '../public/Logo.png'; +import '@/styles.css'; + const Navbar = () => { - const navItems = [ - { label: 'Home', id: 'home' }, - { label: 'Team', id: 'team' }, - { label: 'Projects', id: 'projects' }, - { label: 'Events', id: 'events' }, - { label: 'Notice', id: 'notice' }, - ]; + const [isOpen, setIsOpen] = useState(false); // State for mobile menu + + const navItems = [ + { label: 'Home', id: 'home' }, + { label: 'Team', id: 'team' }, + { label: 'Projects', id: 'projects' }, + { label: 'Events', id: 'events' }, + { label: 'Notice', id: 'notice' }, + ]; + return ( -
-
- Logo -
-
-
+ + {/* Navbar Center (visible on large screens) */} +
+ -
-
- Log In - Sign Up -
-
- ) -} - -export default Navbar \ No newline at end of file + + ))} + + + + {/* Navbar End (Log In and Sign Up) */} +
+ + Log In + + + Sign Up + +
+ + {/* Mobile Menu (Log In and Sign Up - visible when menu is open) */} + {isOpen && ( +
+ + Log In + + + Sign Up + +
+ )} + + ); +}; + +export default Navbar;