diff --git a/website/components/mobile-nav.tsx b/website/components/mobile-nav.tsx new file mode 100644 index 00000000..97c50742 --- /dev/null +++ b/website/components/mobile-nav.tsx @@ -0,0 +1,98 @@ +"use client"; +import React, { useState } from "react"; + +import { ColumnsIcon, Mountain } from "lucide-react"; +import Link, { LinkProps } from "next/link"; +import { usePathname, useRouter } from "next/navigation"; + +import { Button } from "@/components/ui/button"; +import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { cn } from "@/lib/utils"; +import { mobileSidebar } from "@/lib/sidebar"; + +export function MobileNav() { + const pathname = usePathname(); + const [open, setOpen] = useState(false); + + return ( + + + + + + + + Starknet React + + +
+ {mobileSidebar.map((item) => ( +
+

{item.title}

+ {item.items.map((subItem) => ( + subItem.href ? ( + + {subItem.title} + + ) : ( + item.title + )))} +
+ ))} +
+
+
+
+ ); +} + +interface MobileLinkProps extends LinkProps { + onOpenChange?: (open: boolean) => void + children: React.ReactNode + className?: string +} + +function MobileLink({ + href, + onOpenChange, + className, + children, + ...props +}: MobileLinkProps) { + const router = useRouter() + + return ( + { + router.push(href.toString()) + onOpenChange?.(false) + }} + className={cn(className)} + {...props} + > + {children} + + ) +} diff --git a/website/components/site-header.tsx b/website/components/site-header.tsx index 5af737a7..1f733a1a 100644 --- a/website/components/site-header.tsx +++ b/website/components/site-header.tsx @@ -7,13 +7,15 @@ import { MainNav } from "@/components/main-nav"; import { buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { ModeToggle } from "./theme-toggle"; +import { MobileNav } from "./mobile-nav"; export function SiteHeader() { return (
-
+ +