From efcf74ec3f55e92601448d875115a8a77c611ccb Mon Sep 17 00:00:00 2001 From: Ayush Date: Sun, 27 Oct 2024 20:42:14 +0530 Subject: [PATCH] added hamburger icon in navbar --- src/components/Global/Header.jsx | 360 +++++++++++++++++++++---------- 1 file changed, 241 insertions(+), 119 deletions(-) diff --git a/src/components/Global/Header.jsx b/src/components/Global/Header.jsx index c41286c..a5c7cff 100644 --- a/src/components/Global/Header.jsx +++ b/src/components/Global/Header.jsx @@ -2,18 +2,16 @@ import * as React from "react"; import Link from "next/link"; - +import { useState } from "react"; import { cn } from "@/lib/utils"; -// import { Icons } from "@/components/icons"; import { NavigationMenu as UiNavigationMenu, - NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, - NavigationMenuTrigger, navigationMenuTriggerStyle, } from "@/components/ui/navigation-menu"; +import { HiOutlineMenu } from "react-icons/hi"; const components = [ { @@ -54,6 +52,8 @@ const components = [ ]; export function NavigationMenu() { + const [isMenuOpen, setIsMenuOpen] = useState(false); + return ( <>
@@ -79,124 +79,246 @@ export function NavigationMenu() {
- {/* Right-Aligned Menu */} -
- - - - - - Projects - - - - - Hackathons - - - - - - - Events - - - - - - - Teams & Gallery - - - - - - - Subscribe - - - - - - - About GDSC - - - - - - - FAQs & Forum - - - - - - - Resources - - - - - - - Careers - - - - - - - Sign In - - - - - - - Sign Up - - - - - + {/* Right-Aligned Menu with Hamburger Icon */} +
+ + + {/* Desktop Navigation */} +
+ + + + + + Projects + + + + + + + Hackathons + + + + + + + Events + + + + + + + Teams & Gallery + + + + + + + Subscribe + + + + + + + About GDSC + + + + + + + FAQs & Forum + + + + + + + Resources + + + + + + + Careers + + + + + + + Sign In + + + + + + + Sign Up + + + + + +
+ + {/* Mobile Dropdown Menu */} + {isMenuOpen && ( +
+ + + + + + Projects + + + + + + + Hackathons + + + + + + + Events + + + + + + + Teams & Gallery + + + + + + + Subscribe + + + + + + + About GDSC + + + + + + + FAQs & Forum + + + + + + + Resources + + + + + + + Careers + + + + + + + Sign In + + + + + + + Sign Up + + + + + +
+ )}
); } -const ListItem = React.forwardRef( - ({ className, title, children, ...props }, ref) => { - return ( -
  • - - -
    {title}
    -

    - {children} -

    -
    -
    -
  • - ); - } -); -ListItem.displayName = "ListItem"; +export default NavigationMenu;