From 900fe1e5a5bcc0f2ddb5d67d47c950797bf5374d Mon Sep 17 00:00:00 2001 From: kleap-admin Date: Thu, 15 Jan 2026 13:03:46 +0000 Subject: [PATCH] Update components/navbar/mobile-navbar.tsx --- components/navbar/mobile-navbar.tsx | 103 ++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 components/navbar/mobile-navbar.tsx diff --git a/components/navbar/mobile-navbar.tsx b/components/navbar/mobile-navbar.tsx new file mode 100644 index 0000000..094ff80 --- /dev/null +++ b/components/navbar/mobile-navbar.tsx @@ -0,0 +1,103 @@ +"use client"; +import { cn } from "@/lib/utils"; +import Link from "next/link"; +import { useState } from "react"; +import { IoIosMenu, IoIosClose } from "react-icons/io"; +import { Logo } from "../Logo"; +import { useMotionValueEvent, useScroll } from "framer-motion"; +import { ModeToggle } from "../mode-toggle"; + +type NavItem = { + title: string; + link: string; + target?: "_blank"; + children?: NavItem[]; +}; + +type Props = { + navItems: NavItem[]; +}; + +export const MobileNavbar = ({ navItems }: Props) => { + const [open, setOpen] = useState(false); + + const { scrollY } = useScroll(); + + const [showBackground, setShowBackground] = useState(false); + + useMotionValueEvent(scrollY, "change", (value) => { + if (value > 100) { + setShowBackground(true); + } else { + setShowBackground(false); + } + }); + + return ( +
+ + setOpen(!open)} + /> + {open && ( +
+
+ +
+ + setOpen(!open)} + /> +
+
+
+ {navItems.map((navItem) => + navItem.children && navItem.children.length > 0 ? ( + navItem.children.map((childNavItem) => ( + setOpen(false)} + className="relative max-w-[15rem] text-left text-2xl" + > + + {childNavItem.title} + + + )) + ) : ( + setOpen(false)} + className="relative" + > + + {navItem.title} + + + ) + )} +
+ {/* Login/Signup buttons - uncomment to enable authentication */} + {/*
+ + +
*/} +
+ )} +
+ ); +};