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 ( +