diff --git a/components/site/mobile-navigation.tsx b/components/site/mobile-navigation.tsx new file mode 100644 index 0000000..b09266c --- /dev/null +++ b/components/site/mobile-navigation.tsx @@ -0,0 +1,135 @@ +'use client'; + +import { useEffect, useRef, useState } from 'react'; +import { RiCloseLine, RiMenuLine } from '@remixicon/react'; + +import { Logo } from '@/components/site/logo'; +import { + Sheet, + SheetClose, + SheetContent, + SheetDescription, + SheetTitle, + SheetTrigger, +} from '@/components/ui/sheet'; + +export type NavigationItem = { + label: string; + href: string; + description: string; +}; + +export function MobileNavigation({ items }: { items: NavigationItem[] }) { + const [open, setOpen] = useState(false); + const navigating = useRef(false); + + useEffect(() => { + const desktop = window.matchMedia('(min-width: 768px)'); + const closeOnDesktop = () => { + if (desktop.matches) setOpen(false); + }; + + desktop.addEventListener('change', closeOnDesktop); + return () => desktop.removeEventListener('change', closeOnDesktop); + }, []); + + return ( + + + + + + { + // Let the anchor move focus to its section without the trigger + // interrupting the page's smooth scroll when the sheet closes. + if (navigating.current) event.preventDefault(); + navigating.current = false; + }} + > +
+ + + + +
+ +
+ + Explore Vertex + + + Explore our products, solutions, resources, documentation, and pricing. + + +
+ +
+ + { + navigating.current = true; + }} + className="flex h-12 items-center justify-center rounded-full bg-white px-4 text-sm font-medium text-black transition-colors hover:bg-white/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30 focus-visible:ring-offset-2 focus-visible:ring-offset-black" + > + Sign Up + + + + { + navigating.current = true; + }} + className="flex h-12 items-center justify-center rounded-full border border-white/10 px-4 text-sm font-medium text-white/70 transition-colors hover:bg-white/5 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/30" + > + Log In + + +
+
+
+ ); +} diff --git a/components/site/navbar.tsx b/components/site/navbar.tsx index 5031be1..8069618 100644 --- a/components/site/navbar.tsx +++ b/components/site/navbar.tsx @@ -1,7 +1,14 @@ import { Logo } from '@/components/site/logo'; +import { MobileNavigation } from '@/components/site/mobile-navigation'; import { Button } from '@/components/ui/button'; -const links = ['Products', 'Solutions', 'Resources', 'Docs', 'Pricing']; +const navigationItems = [ + { label: 'Products', href: '#', description: 'Everything you need to ship' }, + { label: 'Solutions', href: '#', description: 'Built for teams of every size' }, + { label: 'Resources', href: '#', description: 'Guides, templates, and changelog' }, + { label: 'Docs', href: '#', description: 'Your first deploy starts here' }, + { label: 'Pricing', href: '#', description: 'Start free. Scale at your pace.' }, +]; export function Navbar() { return ( @@ -10,13 +17,13 @@ export function Navbar() {
diff --git a/components/ui/sheet.tsx b/components/ui/sheet.tsx index 8d0e1d3..19909ba 100644 --- a/components/ui/sheet.tsx +++ b/components/ui/sheet.tsx @@ -50,14 +50,16 @@ function SheetContent({ children, side = "right", showCloseButton = true, + overlayClassName, ...props }: React.ComponentProps & { side?: "top" | "right" | "bottom" | "left" showCloseButton?: boolean + overlayClassName?: string }) { return ( - +