Navbar
Top navigation for sites and apps, built from stock shadcn/ui parts: simple, mega menu, centered logo, search with a command dialog, an app header with notifications and a user menu, and an announcement bar. Every one has a phone menu in a sheet and a visible keyboard focus.
6 examples below. They wear whichever DressCode theme you install.
npx shadcn@latest add https://dresscodeui.com/r/dresscode/navbar-simple.jsoncomponents/dresscode/navbar-simple.tsx
"use client"
// A simple navbar: logo, four links, sign in and the main call to action. On phones the links,
// sign in and the call to action move into a sheet. The current page is marked with aria-current.
import * as React from "react"
import { ArrowRight, Menu, Orbit } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import { cn } from "@/lib/utils"
const LINKS = [
{ label: "Features", href: "#features" },
{ label: "Pricing", href: "#pricing" },
{ label: "Customers", href: "#customers" },
{ label: "Changelog", href: "#changelog" },
]
const focusRing = "outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
function Logo({ className }: { className?: string }) {
return (
<span className={cn("flex items-center gap-2 text-base font-semibold tracking-tight", className)}>
<span className="flex size-7 items-center justify-center rounded-md bg-primary text-primary-foreground">
<Orbit className="size-4" aria-hidden="true" />
</span>
Orbit
</span>
)
}
export function SimpleNavbar({ current = "#features" }: { current?: string }) {
const [open, setOpen] = React.useState(false)
return (
<header className="relative border-b border-border bg-background">
<a
href="#content"
className={cn(
"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-1 ring-border focus:not-sr-only focus:absolute focus:px-3 focus:py-2 focus:top-3 focus:left-3 focus:z-50",
focusRing,
)}
>
Skip to content
</a>
<div className="mx-auto flex h-16 max-w-6xl items-center gap-6 px-4 sm:px-6">
<a href="#top" aria-label="Orbit home" className={cn("rounded-md", focusRing)}>
<Logo />
</a>
<nav aria-label="Main" className="hidden md:block">
<ul className="flex items-center gap-1">
{LINKS.map((link) => (
<li key={link.href}>
<a
href={link.href}
aria-current={link.href === current ? "page" : undefined}
className={cn(
"inline-flex h-9 items-center rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground aria-[current=page]:bg-muted aria-[current=page]:text-foreground",
focusRing,
)}
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
<div className="ml-auto flex items-center gap-2">
<Button variant="ghost" size="lg" className="hidden px-3 md:inline-flex" nativeButton={false} render={<a href="#sign-in" />}>
Sign in
</Button>
<Button size="lg" className="px-3.5" nativeButton={false} render={<a href="#start" />}>
Start free trial
</Button>
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger render={<Button variant="ghost" size="icon-lg" className="md:hidden" aria-label="Open menu" />}>
<Menu className="size-5" />
</SheetTrigger>
<SheetContent side="right" className="gap-0">
<SheetHeader className="border-b border-border">
<SheetTitle>
<Logo />
</SheetTitle>
<SheetDescription className="sr-only">Pages on the Orbit site</SheetDescription>
</SheetHeader>
<nav aria-label="Main" className="flex-1 overflow-y-auto p-3">
<ul className="grid gap-1">
{LINKS.map((link) => (
<li key={link.href}>
<a
href={link.href}
aria-current={link.href === current ? "page" : undefined}
onClick={() => setOpen(false)}
className={cn(
"flex h-11 items-center rounded-md px-3 text-base font-medium transition-colors hover:bg-muted aria-[current=page]:bg-muted",
focusRing,
)}
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
<SheetFooter className="border-t border-border">
<Button variant="outline" size="lg" nativeButton={false} render={<a href="#sign-in" onClick={() => setOpen(false)} />}>
Sign in
</Button>
<Button size="lg" nativeButton={false} render={<a href="#start" onClick={() => setOpen(false)} />}>
Start free trial
</Button>
</SheetFooter>
</SheetContent>
</Sheet>
</div>
</div>
</header>
)
}
export default function NavbarSimple() {
return (
<div className="w-full bg-background text-foreground">
<SimpleNavbar />
<div id="content" tabIndex={-1} className="mx-auto max-w-6xl px-4 py-14 outline-none sm:px-6 sm:py-20">
<h2 className="max-w-2xl font-heading text-3xl font-semibold tracking-tight text-balance sm:text-4xl">Invoices that get paid on time</h2>
<p className="mt-4 max-w-xl text-base leading-relaxed text-muted-foreground">
Send a branded invoice in a minute, let Orbit follow up politely, and get paid by card or bank transfer. Made for studios of one to twenty.
</p>
<a href="#features" className={cn("mt-6 inline-flex items-center gap-1 rounded-md text-sm font-medium underline-offset-4 hover:underline", focusRing)}>
See every feature <ArrowRight className="size-4" aria-hidden="true" />
</a>
</div>
</div>
)
}npx shadcn@latest add https://dresscodeui.com/r/dresscode/navbar-centered.jsoncomponents/dresscode/navbar-centered.tsx
"use client"
// A centered navbar: the logo sits in the middle with links split to its left and right, and the
// call to action at the far right. On phones the menu button moves to the left and opens a sheet
// from that side; the logo stays centered.
import * as React from "react"
import { ArrowRight, Menu, Orbit } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Separator } from "@/components/ui/separator"
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import { cn } from "@/lib/utils"
const LEFT = [
{ label: "Features", href: "#features" },
{ label: "Pricing", href: "#pricing" },
{ label: "Customers", href: "#customers" },
]
const RIGHT = [
{ label: "Journal", href: "#journal" },
{ label: "Help", href: "#help" },
]
const focusRing = "outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
const linkClass = cn(
"inline-flex h-9 items-center rounded-md px-3 text-sm font-medium text-muted-foreground decoration-primary decoration-2 underline-offset-[10px] transition-colors hover:text-foreground aria-[current=page]:text-foreground aria-[current=page]:underline",
focusRing,
)
function Logo({ className }: { className?: string }) {
return (
<span className={cn("flex items-center gap-2 text-lg font-semibold tracking-tight", className)}>
<span className="flex size-8 items-center justify-center rounded-full bg-primary text-primary-foreground">
<Orbit className="size-4.5" aria-hidden="true" />
</span>
Orbit
</span>
)
}
function NavLinks({ links, current }: { links: typeof LEFT; current: string }) {
return (
<ul className="flex items-center gap-1">
{links.map((link) => (
<li key={link.href}>
<a href={link.href} aria-current={link.href === current ? "page" : undefined} className={linkClass}>
{link.label}
</a>
</li>
))}
</ul>
)
}
function MobileMenu({ current }: { current: string }) {
const [open, setOpen] = React.useState(false)
return (
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger render={<Button variant="ghost" size="icon-lg" className="-ml-2 md:hidden" aria-label="Open menu" />}>
<Menu className="size-5" />
</SheetTrigger>
<SheetContent side="left" className="gap-0">
<SheetHeader className="border-b border-border">
<SheetTitle>
<Logo className="text-base" />
</SheetTitle>
<SheetDescription className="sr-only">Pages on the Orbit site</SheetDescription>
</SheetHeader>
<nav aria-label="Main" className="flex-1 overflow-y-auto p-3">
{[LEFT, RIGHT].map((group, i) => (
<React.Fragment key={i}>
{i > 0 ? <Separator className="my-2" /> : null}
<ul className="grid gap-1">
{group.map((link) => (
<li key={link.href}>
<a
href={link.href}
aria-current={link.href === current ? "page" : undefined}
onClick={() => setOpen(false)}
className={cn(
"flex h-11 items-center justify-between rounded-md px-3 text-base font-medium transition-colors hover:bg-muted aria-[current=page]:bg-muted",
focusRing,
)}
>
{link.label}
{link.href === current ? <span className="size-1.5 rounded-full bg-primary" aria-hidden="true" /> : null}
</a>
</li>
))}
</ul>
</React.Fragment>
))}
</nav>
<SheetFooter className="border-t border-border">
<Button variant="outline" size="lg" nativeButton={false} render={<a href="#sign-in" onClick={() => setOpen(false)} />}>
Sign in
</Button>
<Button size="lg" nativeButton={false} render={<a href="#demo" onClick={() => setOpen(false)} />}>
Book a demo
</Button>
</SheetFooter>
</SheetContent>
</Sheet>
)
}
export function CenteredNavbar({ current = "#features" }: { current?: string }) {
return (
<header className="relative border-b border-border bg-background">
<a
href="#content"
className={cn(
"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-1 ring-border focus:not-sr-only focus:absolute focus:px-3 focus:py-2 focus:top-3 focus:left-3 focus:z-50",
focusRing,
)}
>
Skip to content
</a>
{/* One nav landmark for both halves, so screen readers hear the links as one list of places. */}
<nav aria-label="Main" className="mx-auto grid h-18 max-w-6xl grid-cols-[1fr_auto_1fr] items-center gap-4 px-4 sm:px-6">
<div className="flex items-center">
<MobileMenu current={current} />
<div className="hidden md:block">
<NavLinks links={LEFT} current={current} />
</div>
</div>
<a href="#top" aria-label="Orbit home" className={cn("rounded-full", focusRing)}>
<Logo />
</a>
<div className="flex items-center justify-end gap-1">
<div className="hidden md:block">
<NavLinks links={RIGHT.slice(0, 1)} current={current} />
</div>
<div className="hidden lg:block">
<NavLinks links={RIGHT.slice(1)} current={current} />
</div>
<a href="#sign-in" className={cn(linkClass, "-mr-2 md:mr-0")}>
Sign in
</a>
<Button size="lg" variant="outline" className="ml-2 hidden px-3.5 md:inline-flex" nativeButton={false} render={<a href="#demo" />}>
Book a demo
</Button>
</div>
</nav>
</header>
)
}
export default function NavbarCentered() {
return (
<div className="w-full bg-background text-foreground">
<CenteredNavbar />
<div id="content" tabIndex={-1} className="mx-auto max-w-3xl px-4 py-14 text-center outline-none sm:px-6 sm:py-20">
<h2 className="font-heading text-3xl font-semibold tracking-tight text-balance sm:text-4xl">Invoicing that feels like part of the studio</h2>
<p className="mx-auto mt-4 max-w-xl text-base leading-relaxed text-muted-foreground">
Your logo, your words, your currency. Orbit sends the invoice, follows up when it is late and tells you the moment it is paid.
</p>
<div className="mt-7 flex flex-wrap justify-center gap-3">
<Button size="lg" className="px-4" nativeButton={false} render={<a href="#start" />}>
Start free trial
</Button>
<Button size="lg" variant="ghost" className="px-4" nativeButton={false} render={<a href="#tour" />}>
Take the tour <ArrowRight data-icon="inline-end" aria-hidden="true" />
</Button>
</div>
</div>
</div>
)
}With search
A search button with a Ctrl K hint that opens a command dialog with grouped results and recent searches.
npx shadcn@latest add https://dresscodeui.com/r/dresscode/navbar-search.jsoncomponents/dresscode/navbar-search.tsx
"use client"
// A navbar with search: a search button that shows its shortcut (Ctrl K, or ⌘K on a Mac; / works
// too) and opens a command dialog. Results are grouped, filter as you type, move with the arrow
// keys and open with Enter; with an empty query it offers recent searches. On phones the search
// becomes an icon button and the links move into a sheet.
import * as React from "react"
import {
BellRing,
Code,
CornerDownLeft,
CreditCard,
FileText,
Globe,
History,
KeyRound,
LifeBuoy,
Menu,
Orbit,
Repeat,
Search,
Sparkles,
Webhook,
type LucideIcon,
} from "lucide-react"
import { Button } from "@/components/ui/button"
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "@/components/ui/command"
import { Kbd, KbdGroup } from "@/components/ui/kbd"
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import { cn } from "@/lib/utils"
const LINKS = [
{ label: "Getting started", href: "#getting-started" },
{ label: "Guides", href: "#guides" },
{ label: "API", href: "#api" },
{ label: "Changelog", href: "#changelog" },
]
type Result = { icon: LucideIcon; title: string; where: string; href: string; keywords?: string[] }
const RESULTS: { heading: string; items: Result[] }[] = [
{
heading: "Guides",
items: [
{ icon: FileText, title: "Send your first invoice", where: "Getting started", href: "#first-invoice", keywords: ["create", "new", "bill"] },
{ icon: BellRing, title: "Set up automatic reminders", where: "Getting paid", href: "#reminders", keywords: ["late", "overdue", "follow up"] },
{ icon: CreditCard, title: "Accept card payments", where: "Getting paid", href: "#card-payments", keywords: ["stripe", "pay", "checkout"] },
{ icon: Repeat, title: "Bill a retainer every month", where: "Recurring billing", href: "#retainers", keywords: ["subscription", "recurring"] },
{ icon: Globe, title: "Invoice in another currency", where: "Invoices", href: "#currencies", keywords: ["euro", "exchange", "fx"] },
],
},
{
heading: "API reference",
items: [
{ icon: Code, title: "Create an invoice", where: "POST /v1/invoices", href: "#api-create-invoice" },
{ icon: Webhook, title: "Webhooks for paid invoices", where: "invoice.paid", href: "#api-webhooks", keywords: ["events", "notify"] },
{ icon: KeyRound, title: "API keys and scopes", where: "Authentication", href: "#api-keys", keywords: ["token", "secret"] },
],
},
{
heading: "Help",
items: [
{ icon: Sparkles, title: "What's new in November", where: "Changelog", href: "#changelog" },
{ icon: LifeBuoy, title: "Contact support", where: "A person replies within a day", href: "#contact", keywords: ["help", "email", "chat"] },
],
},
]
const RECENT = ["Reminders", "API keys"]
const focusRing = "outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
// ⌘ on Apple keyboards, Ctrl everywhere else. Read on the client only, so the server render says Ctrl.
const subscribeNever = () => () => {}
function useIsMac() {
return React.useSyncExternalStore(
subscribeNever,
() => /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent),
() => false,
)
}
function Logo() {
return (
<span className="flex items-center gap-2 text-base font-semibold tracking-tight">
<span className="flex size-7 items-center justify-center rounded-md bg-primary text-primary-foreground">
<Orbit className="size-4" aria-hidden="true" />
</span>
Orbit
<span className="font-normal text-muted-foreground">Help</span>
</span>
)
}
function SearchDialog({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) {
const [query, setQuery] = React.useState("")
const go = (href: string) => {
onOpenChange(false)
setQuery("")
window.location.hash = href
}
return (
<CommandDialog
open={open}
onOpenChange={(next) => {
onOpenChange(next)
if (!next) setQuery("")
}}
title="Search the help center"
description="Find guides, API reference and answers."
className="top-4 sm:top-[12vh] sm:max-w-xl"
>
<Command loop>
<CommandInput value={query} onValueChange={setQuery} placeholder="Search guides, API and answers" aria-label="Search the help center" />
<CommandList className="max-h-[min(22rem,calc(100svh-9rem))]">
<CommandEmpty>
<p>No results for “{query}”.</p>
<button type="button" onClick={() => go("#contact")} className={cn("mt-2 rounded-sm font-medium underline underline-offset-4", focusRing)}>
Ask a person instead
</button>
</CommandEmpty>
{query ? null : (
<>
<CommandGroup heading="Recent searches">
{RECENT.map((r) => (
<CommandItem key={r} value={`recent ${r}`} onSelect={() => setQuery(r)}>
<History className="text-muted-foreground" aria-hidden="true" />
{r}
<CommandShortcut className="tracking-normal">Search</CommandShortcut>
</CommandItem>
))}
</CommandGroup>
<CommandSeparator />
</>
)}
{RESULTS.map((group) => (
<CommandGroup key={group.heading} heading={group.heading}>
{group.items.map((item) => (
<CommandItem key={item.href} value={`${item.title} ${item.where}`} keywords={item.keywords} onSelect={() => go(item.href)} className="gap-3 py-2">
<span className="flex size-8 shrink-0 items-center justify-center rounded-md border border-border bg-background text-muted-foreground">
<item.icon aria-hidden="true" />
</span>
<span className="min-w-0 flex-1">
<span className="block truncate font-medium">{item.title}</span>
<span className="block truncate text-xs text-muted-foreground">{item.where}</span>
</span>
<CommandShortcut className="opacity-0 group-data-[selected=true]/command-item:opacity-100">
<CornerDownLeft className="size-3.5" aria-hidden="true" />
</CommandShortcut>
</CommandItem>
))}
</CommandGroup>
))}
</CommandList>
<div className="flex justify-end border-t border-border p-2 sm:hidden">
<Button variant="ghost" size="sm" onClick={() => onOpenChange(false)}>
Close
</Button>
</div>
<div className="hidden items-center gap-4 border-t border-border px-3 py-2 text-xs text-muted-foreground sm:flex">
<span className="flex items-center gap-1.5">
<KbdGroup>
<Kbd>↑</Kbd>
<Kbd>↓</Kbd>
</KbdGroup>
to move
</span>
<span className="flex items-center gap-1.5">
<Kbd>Enter</Kbd> to open
</span>
<span className="ml-auto flex items-center gap-1.5">
<Kbd>Esc</Kbd> to close
</span>
</div>
</Command>
</CommandDialog>
)
}
function MobileMenu({ current }: { current: string }) {
const [open, setOpen] = React.useState(false)
return (
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger render={<Button variant="ghost" size="icon-lg" className="lg:hidden" aria-label="Open menu" />}>
<Menu className="size-5" />
</SheetTrigger>
<SheetContent side="right" className="gap-0">
<SheetHeader className="border-b border-border">
<SheetTitle>
<Logo />
</SheetTitle>
<SheetDescription className="sr-only">Sections of the help center</SheetDescription>
</SheetHeader>
<nav aria-label="Main" className="flex-1 overflow-y-auto p-3">
<ul className="grid gap-1">
{LINKS.map((link) => (
<li key={link.href}>
<a
href={link.href}
aria-current={link.href === current ? "page" : undefined}
onClick={() => setOpen(false)}
className={cn("flex h-11 items-center rounded-md px-3 text-base font-medium transition-colors hover:bg-muted aria-[current=page]:bg-muted", focusRing)}
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
<SheetFooter className="border-t border-border">
<Button variant="outline" size="lg" nativeButton={false} render={<a href="#contact" onClick={() => setOpen(false)} />}>
Contact support
</Button>
<Button size="lg" nativeButton={false} render={<a href="#app" onClick={() => setOpen(false)} />}>
Open Orbit
</Button>
</SheetFooter>
</SheetContent>
</Sheet>
)
}
export function SearchNavbar({ current = "#guides" }: { current?: string }) {
const [open, setOpen] = React.useState(false)
const isMac = useIsMac()
// Ctrl K / ⌘K toggles the dialog from anywhere; "/" opens it unless you are typing in a field.
React.useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
if (e.key.toLowerCase() === "k" && (e.metaKey || e.ctrlKey)) {
e.preventDefault()
setOpen((o) => !o)
return
}
const el = e.target as HTMLElement | null
const typing = el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName))
if (e.key === "/" && !typing && !e.metaKey && !e.ctrlKey && !e.altKey) {
e.preventDefault()
setOpen(true)
}
}
document.addEventListener("keydown", onKeyDown)
return () => document.removeEventListener("keydown", onKeyDown)
}, [])
return (
<>
<header className="relative border-b border-border bg-background">
<a
href="#content"
className={cn(
"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-1 ring-border focus:not-sr-only focus:absolute focus:px-3 focus:py-2 focus:top-3 focus:left-3 focus:z-50",
focusRing,
)}
>
Skip to content
</a>
<div className="mx-auto flex h-16 max-w-6xl items-center gap-6 px-4 sm:px-6">
<a href="#top" aria-label="Orbit help center home" className={cn("rounded-md", focusRing)}>
<Logo />
</a>
<nav aria-label="Main" className="hidden lg:block">
<ul className="flex items-center gap-1">
{LINKS.map((link) => (
<li key={link.href}>
<a
href={link.href}
aria-current={link.href === current ? "page" : undefined}
className={cn(
"relative inline-flex h-9 items-center rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground aria-[current=page]:text-foreground",
// The current section gets a bar that sits on the header's bottom border.
"after:absolute after:inset-x-3 after:-bottom-3.5 after:h-0.5 after:rounded-full aria-[current=page]:after:bg-primary",
focusRing,
)}
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
<div className="ml-auto flex items-center gap-2">
<button
type="button"
onClick={() => setOpen(true)}
aria-keyshortcuts={isMac ? "Meta+K /" : "Control+K /"}
className={cn(
"hidden h-9 w-56 items-center gap-2 rounded-lg border border-input bg-background px-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground sm:flex xl:w-64",
focusRing,
)}
>
<Search className="size-4 shrink-0" aria-hidden="true" />
<span className="flex-1 text-left">Search help</span>
<KbdGroup aria-hidden="true">
<Kbd>{isMac ? "⌘" : "Ctrl"}</Kbd>
<Kbd>K</Kbd>
</KbdGroup>
</button>
<Button variant="ghost" size="icon-lg" className="sm:hidden" aria-label="Search help" onClick={() => setOpen(true)}>
<Search className="size-5" />
</Button>
<Button size="lg" className="hidden px-3.5 sm:inline-flex" nativeButton={false} render={<a href="#app" />}>
Open Orbit
</Button>
<MobileMenu current={current} />
</div>
</div>
</header>
{/* Outside the header, so the dialog's hidden title is not read as part of the banner. */}
<SearchDialog open={open} onOpenChange={setOpen} />
</>
)
}
export default function NavbarSearch() {
return (
<div className="w-full bg-background text-foreground">
<SearchNavbar />
<div id="content" tabIndex={-1} className="mx-auto max-w-6xl px-4 py-14 outline-none sm:px-6 sm:py-20">
<p className="text-sm font-medium text-muted-foreground">Guides</p>
<h2 className="mt-2 max-w-2xl font-heading text-3xl font-semibold tracking-tight text-balance sm:text-4xl">How can we help?</h2>
<p className="mt-4 max-w-xl text-base leading-relaxed text-muted-foreground">
Step-by-step guides for invoices, reminders and payments, plus the full API reference. Press{" "}
<Kbd className="align-middle">/</Kbd> to search from anywhere on this page.
</p>
</div>
</div>
)
}App header
A product top bar: breadcrumb, search with suggestions, a notifications popover with unread counts, a user menu and section tabs.
npx shadcn@latest add https://dresscodeui.com/r/dresscode/navbar-app-header.jsoncomponents/dresscode/navbar-app-header.tsx
"use client"
// An app header: logo, breadcrumb to the current page, a search field that suggests invoices and
// clients as you type ("/" focuses it), a notifications popover with unread counts, tabs and
// mark-as-read, and a user menu. A row of section tabs sits below. On phones the sections and the
// search move into a sheet and the breadcrumb keeps its last two steps.
import * as React from "react"
import {
Bell,
BellOff,
ChartColumn,
CheckCheck,
ClockAlert,
CreditCard,
FileText,
History,
Keyboard,
Landmark,
LayoutDashboard,
LifeBuoy,
LogOut,
Menu,
Orbit,
Receipt,
Search,
Settings,
User,
Users,
type LucideIcon,
} from "lucide-react"
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge"
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "@/components/ui/breadcrumb"
import { Button } from "@/components/ui/button"
import { Command, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut } from "@/components/ui/command"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Kbd } from "@/components/ui/kbd"
import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "@/components/ui/popover"
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { cn } from "@/lib/utils"
const SECTIONS: { label: string; href: string; icon: LucideIcon }[] = [
{ label: "Overview", href: "#overview", icon: LayoutDashboard },
{ label: "Invoices", href: "#invoices", icon: FileText },
{ label: "Clients", href: "#clients", icon: Users },
{ label: "Expenses", href: "#expenses", icon: Receipt },
{ label: "Reports", href: "#reports", icon: ChartColumn },
{ label: "Settings", href: "#settings", icon: Settings },
]
const CURRENT = "#invoices"
type Hit = { title: string; meta: string; href: string; status?: "Sent" | "Paid" | "Draft" | "Overdue" }
const SEARCH: { heading: string; items: Hit[] }[] = [
{
heading: "Invoices",
items: [
{ title: "INV-1043", meta: "Fernwood Studio · $4,200.00", status: "Sent", href: "#inv-1043" },
{ title: "INV-1042", meta: "Kato & Lee · $1,860.00", status: "Paid", href: "#inv-1042" },
{ title: "INV-1041", meta: "Marlow & Daughters · $640.00", status: "Draft", href: "#inv-1041" },
{ title: "INV-1036", meta: "Pellucid Health · $2,400.00", status: "Overdue", href: "#inv-1036" },
],
},
{
heading: "Clients",
items: [
{ title: "Fernwood Studio", meta: "2 open invoices", href: "#client-fernwood" },
{ title: "Kato & Lee", meta: "Paid up", href: "#client-kato-lee" },
{ title: "Marlow & Daughters", meta: "1 draft", href: "#client-marlow" },
{ title: "Pellucid Health", meta: "1 overdue", href: "#client-pellucid" },
],
},
]
const RECENT = SEARCH[0].items.slice(0, 1).concat(SEARCH[1].items.slice(0, 1))
type Notification = {
id: string
who: string
what: string
detail: string
time: string
unread: boolean
icon?: LucideIcon
initials?: string
}
const NOTIFICATIONS: Notification[] = [
{ id: "n1", icon: CreditCard, who: "Kato & Lee", what: "paid INV-1042", detail: "$1,860.00 by card, 4 days after the reminder.", time: "10 min ago", unread: true },
{ id: "n2", initials: "TO", who: "Tom Okafor", what: "commented on INV-1043", detail: "“Can we split this into two payments?”", time: "1 hour ago", unread: true },
{ id: "n3", icon: ClockAlert, who: "INV-1036", what: "is 15 days overdue", detail: "The next reminder goes to Pellucid Health on Friday.", time: "3 hours ago", unread: true },
{ id: "n4", initials: "ML", who: "Maya Lindqvist", what: "joined Halden Studio", detail: "She can create and send invoices.", time: "Yesterday", unread: false },
{ id: "n5", icon: Landmark, who: "Your November payout", what: "is on its way", detail: "$12,480.00 to the account ending 4410.", time: "Nov 21", unread: false },
]
const focusRing = "outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
const go = (href: string) => {
window.location.hash = href
}
function LogoMark() {
return (
<span className="flex size-8 items-center justify-center rounded-md bg-primary text-primary-foreground">
<Orbit className="size-4.5" aria-hidden="true" />
</span>
)
}
/** Search as you type: suggestions open under the field, arrows move, Enter opens, Escape closes. */
function HeaderSearch({
className,
listClassName,
openOnFocus = true,
onNavigate,
}: {
className?: string
listClassName?: string
/** Show recent items as soon as the field is focused. Off in the phone sheet, where focus can land there on open. */
openOnFocus?: boolean
onNavigate?: () => void
}) {
const [query, setQuery] = React.useState("")
const [open, setOpen] = React.useState(false)
const inputRef = React.useRef<HTMLInputElement>(null)
const choose = (href: string) => {
setOpen(false)
setQuery("")
inputRef.current?.blur()
onNavigate?.()
go(href)
}
return (
<Command
loop
label="Search invoices and clients"
className={cn("group/search relative h-auto overflow-visible rounded-none! bg-transparent p-0 **:data-[slot=command-input-wrapper]:p-0", className)}
onKeyDown={(e) => {
if (e.key === "Escape" && open) {
e.preventDefault()
setOpen(false)
} else if (!open && (e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp")) {
e.preventDefault()
setOpen(true)
}
}}
>
<CommandInput
ref={inputRef}
data-header-search=""
value={query}
onValueChange={(v) => {
setQuery(v)
setOpen(true)
}}
onFocus={() => openOnFocus && setOpen(true)}
onBlur={() => setOpen(false)}
placeholder="Search invoices and clients"
className="pr-7"
/>
<Kbd aria-hidden="true" className="absolute top-1/2 right-1.5 -translate-y-1/2 bg-background group-focus-within/search:hidden">
/
</Kbd>
<CommandList
// Keep focus in the field while clicking a suggestion.
onMouseDown={(e) => e.preventDefault()}
className={cn(
"absolute top-full z-50 mt-2 max-h-80 rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10",
!open && "hidden",
listClassName,
)}
>
{query ? null : (
<CommandGroup heading="Recent">
{RECENT.map((r) => (
<CommandItem key={r.href} value={`recent ${r.title}`} onSelect={() => choose(r.href)}>
<History className="text-muted-foreground" aria-hidden="true" />
<span className="min-w-0 flex-1">
<span className="block truncate font-medium">{r.title}</span>
<span className="block truncate text-xs text-muted-foreground">{r.meta}</span>
</span>
</CommandItem>
))}
</CommandGroup>
)}
{query
? SEARCH.map((group) => (
<CommandGroup key={group.heading} heading={group.heading}>
{group.items.map((item) => (
<CommandItem key={item.href} value={`${item.title} ${item.meta}`} onSelect={() => choose(item.href)}>
{group.heading === "Invoices" ? <FileText className="text-muted-foreground" aria-hidden="true" /> : <Users className="text-muted-foreground" aria-hidden="true" />}
<span className="min-w-0 flex-1">
<span className="block truncate font-medium">{item.title}</span>
<span className="block truncate text-xs text-muted-foreground">{item.meta}</span>
</span>
{item.status ? (
<CommandShortcut className="tracking-normal">
<Badge variant={item.status === "Overdue" ? "destructive" : item.status === "Paid" ? "secondary" : "outline"}>{item.status}</Badge>
</CommandShortcut>
) : null}
</CommandItem>
))}
</CommandGroup>
))
: null}
{query ? (
<CommandGroup forceMount>
<CommandItem forceMount value="search-everywhere" onSelect={() => choose(`#search?q=${encodeURIComponent(query)}`)}>
<Search className="text-muted-foreground" aria-hidden="true" />
<span className="truncate">
Search everything for <span className="font-medium">“{query}”</span>
</span>
<CommandShortcut className="tracking-normal">Enter</CommandShortcut>
</CommandItem>
</CommandGroup>
) : null}
</CommandList>
</Command>
)
}
function NotificationList({ items, onRead }: { items: Notification[]; onRead: (id: string) => void }) {
if (!items.length) {
return (
<div className="flex flex-col items-center px-6 py-10 text-center">
<span className="flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground">
<BellOff className="size-5" aria-hidden="true" />
</span>
<p className="mt-3 text-sm font-medium">You're all caught up</p>
<p className="mt-1 text-[13px] text-balance text-muted-foreground">New payments, comments and late invoices show up here.</p>
</div>
)
}
return (
<ul className="max-h-[min(20rem,calc(100svh-14rem))] divide-y divide-border overflow-y-auto">
{items.map((n) => (
<li key={n.id}>
<button
type="button"
onClick={() => onRead(n.id)}
className={cn("flex w-full gap-3 px-4 py-3 text-left transition-colors hover:bg-muted focus-visible:bg-muted", "outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset")}
>
{n.initials ? (
<Avatar>
<AvatarFallback className="text-xs">{n.initials}</AvatarFallback>
</Avatar>
) : n.icon ? (
<span className="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
<n.icon className="size-4" aria-hidden="true" />
</span>
) : null}
<span className="min-w-0 flex-1">
<span className="block text-sm leading-snug">
<span className="font-medium">{n.who}</span> <span className="text-muted-foreground">{n.what}</span>
</span>
<span className="mt-0.5 block text-[13px] leading-snug text-muted-foreground">{n.detail}</span>
<span className="mt-1 block text-xs text-muted-foreground">{n.time}</span>
</span>
{n.unread ? (
<span className="mt-1.5 size-2 shrink-0 rounded-full bg-primary">
<span className="sr-only">Unread</span>
</span>
) : null}
</button>
</li>
))}
</ul>
)
}
function NotificationsMenu() {
const [items, setItems] = React.useState(NOTIFICATIONS)
const [tab, setTab] = React.useState<string>("all")
const unread = items.filter((n) => n.unread).length
const read = (id: string) => setItems((list) => list.map((n) => (n.id === id ? { ...n, unread: false } : n)))
const readAll = () => setItems((list) => list.map((n) => ({ ...n, unread: false })))
return (
<Popover>
<PopoverTrigger render={<Button variant="ghost" size="icon-lg" className="relative" aria-label={unread ? `Notifications, ${unread} unread` : "Notifications"} />}>
<Bell className="size-5" />
{unread ? (
<span
aria-hidden="true"
className="absolute top-1 right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] leading-none font-semibold text-primary-foreground ring-2 ring-background"
>
{unread}
</span>
) : null}
</PopoverTrigger>
<PopoverContent align="end" sideOffset={8} className="w-[min(24rem,calc(100vw-1rem))] gap-0 p-0">
<div className="flex items-center justify-between gap-2 px-4 pt-3 pb-1">
<PopoverTitle className="text-sm font-semibold">Notifications</PopoverTitle>
<Button variant="ghost" size="xs" onClick={readAll} disabled={!unread}>
<CheckCheck aria-hidden="true" /> Mark all as read
</Button>
</div>
<Tabs value={tab} onValueChange={(v) => setTab(String(v))} className="gap-0">
<TabsList variant="line" className="h-9 w-full justify-start rounded-none border-b border-border px-3">
<TabsTrigger value="all" className="flex-none px-2">
All
</TabsTrigger>
<TabsTrigger value="unread" className="flex-none px-2">
Unread
{unread ? (
<Badge variant="secondary" className="h-4 px-1.5 text-[10px]">
{unread}
</Badge>
) : null}
</TabsTrigger>
</TabsList>
<TabsContent value="all">
<NotificationList items={items} onRead={read} />
</TabsContent>
<TabsContent value="unread">
<NotificationList items={items.filter((n) => n.unread)} onRead={read} />
</TabsContent>
</Tabs>
<div className="flex items-center justify-between border-t border-border px-4 py-2.5 text-[13px]">
<a href="#notification-settings" className={cn("rounded-sm text-muted-foreground hover:text-foreground", focusRing)}>
Notification settings
</a>
<a href="#notifications" className={cn("rounded-sm font-medium underline-offset-4 hover:underline", focusRing)}>
View all
</a>
</div>
</PopoverContent>
</Popover>
)
}
function UserMenu() {
return (
<DropdownMenu>
<DropdownMenuTrigger render={<Button variant="ghost" size="icon-lg" className="rounded-full" aria-label="Account menu for Ada Lin" />}>
<Avatar>
<AvatarFallback className="bg-secondary text-xs font-medium text-secondary-foreground">AL</AvatarFallback>
</Avatar>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" sideOffset={8} className="w-60">
<DropdownMenuGroup>
<DropdownMenuLabel className="flex items-center gap-2.5 px-2 py-2 text-foreground">
<Avatar>
<AvatarFallback className="bg-secondary text-xs font-medium text-secondary-foreground">AL</AvatarFallback>
</Avatar>
<span className="min-w-0">
<span className="block truncate text-sm font-medium">Ada Lin</span>
<span className="block truncate text-xs font-normal text-muted-foreground">ada@halden.studio</span>
</span>
</DropdownMenuLabel>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem onClick={() => go("#profile")}>
<User aria-hidden="true" /> Profile
</DropdownMenuItem>
<DropdownMenuItem onClick={() => go("#settings")}>
<Settings aria-hidden="true" /> Studio settings
</DropdownMenuItem>
<DropdownMenuItem onClick={() => go("#billing")}>
<CreditCard aria-hidden="true" /> Plan and billing
<Badge variant="secondary" className="ml-auto">
Studio
</Badge>
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem onClick={() => go("#shortcuts")}>
<Keyboard aria-hidden="true" /> Keyboard shortcuts
<DropdownMenuShortcut>?</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem onClick={() => go("#help")}>
<LifeBuoy aria-hidden="true" /> Help and support
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={() => go("#sign-out")}>
<LogOut aria-hidden="true" /> Sign out
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}
function MobileMenu() {
const [open, setOpen] = React.useState(false)
// Focus the current section when the sheet opens, not the search field (that would pop up the keyboard).
const currentLink = React.useRef<HTMLAnchorElement>(null)
return (
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger render={<Button variant="ghost" size="icon-lg" className="-ml-2 md:hidden" aria-label="Open navigation" />}>
<Menu className="size-5" />
</SheetTrigger>
<SheetContent side="left" className="gap-0" initialFocus={currentLink}>
<SheetHeader className="flex-row items-center gap-3 border-b border-border">
<span className="flex size-9 items-center justify-center rounded-md bg-muted text-sm font-semibold">H</span>
<span>
<SheetTitle>Halden Studio</SheetTitle>
<SheetDescription className="text-xs">Studio plan · 4 members</SheetDescription>
</span>
</SheetHeader>
<div className="p-3 pb-1">
<HeaderSearch className="w-full" listClassName="inset-x-0" openOnFocus={false} onNavigate={() => setOpen(false)} />
</div>
<nav aria-label="Sections" className="flex-1 overflow-y-auto p-3">
<ul className="grid gap-0.5">
{SECTIONS.map((s) => (
<li key={s.href}>
<a
ref={s.href === CURRENT ? currentLink : undefined}
href={s.href}
aria-current={s.href === CURRENT ? "page" : undefined}
onClick={() => setOpen(false)}
className={cn(
"flex h-10 items-center gap-3 rounded-md px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground aria-[current=page]:bg-muted aria-[current=page]:text-foreground",
focusRing,
)}
>
<s.icon className="size-4" aria-hidden="true" />
{s.label}
</a>
</li>
))}
</ul>
</nav>
<SheetFooter className="flex-row items-center gap-3 border-t border-border">
<Avatar>
<AvatarFallback className="bg-secondary text-xs font-medium text-secondary-foreground">AL</AvatarFallback>
</Avatar>
<span className="min-w-0 flex-1">
<span className="block truncate text-sm font-medium">Ada Lin</span>
<span className="block truncate text-xs text-muted-foreground">ada@halden.studio</span>
</span>
<Button variant="ghost" size="icon" aria-label="Sign out" onClick={() => go("#sign-out")}>
<LogOut />
</Button>
</SheetFooter>
</SheetContent>
</Sheet>
)
}
export function AppHeader() {
// "/" jumps to the search field unless you are already typing somewhere.
React.useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
const el = e.target as HTMLElement | null
const typing = el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName))
if (e.key !== "/" || typing || e.metaKey || e.ctrlKey || e.altKey) return
const field = [...document.querySelectorAll<HTMLInputElement>("[data-header-search]")].find((f) => f.getClientRects().length)
if (!field) return
e.preventDefault()
field.focus()
}
document.addEventListener("keydown", onKeyDown)
return () => document.removeEventListener("keydown", onKeyDown)
}, [])
return (
<header className="relative border-b border-border bg-background">
<a
href="#content"
className={cn(
"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-1 ring-border focus:not-sr-only focus:absolute focus:px-3 focus:py-2 focus:top-3 focus:left-3 focus:z-50",
focusRing,
)}
>
Skip to content
</a>
<div className="flex h-14 items-center gap-3 px-4 sm:px-6">
<MobileMenu />
<a href="#overview" aria-label="Orbit dashboard" className={cn("shrink-0 rounded-md", focusRing)}>
<LogoMark />
</a>
<Breadcrumb className="min-w-0">
<BreadcrumbList className="flex-nowrap">
<BreadcrumbItem className="hidden sm:inline-flex">
<BreadcrumbLink href="#studio" className={cn("flex items-center gap-2 rounded-sm font-medium text-foreground", focusRing)}>
<span className="flex size-5 items-center justify-center rounded bg-muted text-[11px] font-semibold" aria-hidden="true">
H
</span>
Halden Studio
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator className="hidden sm:block" />
<BreadcrumbItem>
<BreadcrumbLink href="#invoices" className={cn("rounded-sm", focusRing)}>
Invoices
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem className="min-w-0">
<BreadcrumbPage className="truncate font-medium">INV-1043</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
<div className="ml-auto flex items-center gap-1">
<HeaderSearch className="mr-2 hidden w-64 md:block lg:w-72" listClassName="right-0 w-[min(26rem,calc(100vw-2rem))]" />
<NotificationsMenu />
<UserMenu />
</div>
</div>
<nav aria-label="Sections" className="hidden px-4 sm:px-6 md:block">
<ul className="-mb-px flex gap-1">
{SECTIONS.map((s) => (
<li key={s.href}>
<a
href={s.href}
aria-current={s.href === CURRENT ? "page" : undefined}
className={cn(
"relative inline-flex h-10 items-center rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground aria-[current=page]:text-foreground",
"after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:rounded-full aria-[current=page]:after:bg-primary",
"outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",
)}
>
{s.label}
</a>
</li>
))}
</ul>
</nav>
</header>
)
}
export default function NavbarAppHeader() {
return (
<div className="w-full bg-background text-foreground">
<AppHeader />
<div id="content" tabIndex={-1} className="px-4 py-8 outline-none sm:px-6 sm:py-10">
<div className="flex flex-wrap items-center gap-3">
<h2 className="font-heading text-2xl font-semibold tracking-tight">INV-1043</h2>
<Badge variant="outline">Sent</Badge>
</div>
<p className="mt-2 max-w-xl text-sm leading-relaxed text-muted-foreground">
$4,200.00 to Fernwood Studio, due December 8. Tom opened it twice, most recently yesterday at 4:12 PM.
</p>
<div className="mt-5 flex flex-wrap gap-2">
<Button variant="outline" onClick={() => go("#remind")}>
Send a reminder
</Button>
<Button onClick={() => go("#record-payment")}>Record a payment</Button>
</div>
</div>
</div>
)
}Announcement bar
A dismissible announcement above a sticky navbar that turns solid with a border once the page scrolls.
npx shadcn@latest add https://dresscodeui.com/r/dresscode/navbar-announcement.jsoncomponents/dresscode/navbar-announcement.tsx
"use client"
// A dismissible announcement bar above a sticky navbar. The navbar starts transparent over the hero
// and turns solid with a border and a soft shadow once it sticks to the top of the window.
// Dismissing the bar moves focus to the logo, so keyboard users are not left on a removed button.
import * as React from "react"
import { ArrowRight, BellRing, FileText, Menu, Orbit, Sparkles, Wallet, X } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
import { cn } from "@/lib/utils"
const LINKS = [
{ label: "Product", href: "#product" },
{ label: "Pricing", href: "#pricing" },
{ label: "Customers", href: "#customers" },
{ label: "Changelog", href: "#changelog" },
]
const FEATURES = [
{ icon: FileText, title: "Invoices in a minute", body: "Your logo, your words and 30 currencies. Duplicate last month's invoice and change two numbers." },
{ icon: BellRing, title: "Reminders that sound like you", body: "Orbit drafts each follow-up in your tone and waits for your approval before it goes." },
{ icon: Wallet, title: "Paid the way clients like", body: "Cards, bank transfer and payment links, with the money in your account in two days." },
]
const focusRing = "outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
function Logo() {
return (
<span className="flex items-center gap-2 text-base font-semibold tracking-tight">
<span className="flex size-7 items-center justify-center rounded-md bg-primary text-primary-foreground">
<Orbit className="size-4" aria-hidden="true" />
</span>
Orbit
</span>
)
}
export function AnnouncementBar({ onDismiss }: { onDismiss: () => void }) {
return (
<section aria-label="Announcement" className="relative bg-primary text-primary-foreground">
<div className="mx-auto flex min-h-10 max-w-6xl items-center justify-center gap-2.5 py-2 pr-12 pl-4 text-sm sm:px-12">
<Sparkles className="hidden size-4 shrink-0 sm:block" aria-hidden="true" />
<p className="text-pretty sm:text-center">
<span className="font-semibold">New:</span> reminders now write in your own tone.{" "}
<a
href="#update"
className="inline-flex items-center gap-1 rounded-sm font-semibold whitespace-nowrap underline underline-offset-4 outline-none hover:no-underline focus-visible:ring-3 focus-visible:ring-primary-foreground/60"
>
Read the update <ArrowRight className="size-3.5" aria-hidden="true" />
</a>
</p>
</div>
<Button
variant="ghost"
size="icon-sm"
aria-label="Dismiss announcement"
onClick={onDismiss}
className="absolute top-1/2 right-2 -translate-y-1/2 text-primary-foreground hover:bg-primary-foreground/15 hover:text-primary-foreground focus-visible:border-primary-foreground focus-visible:ring-primary-foreground/50"
>
<X />
</Button>
</section>
)
}
function MobileMenu() {
const [open, setOpen] = React.useState(false)
return (
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger render={<Button variant="ghost" size="icon-lg" className="lg:hidden" aria-label="Open menu" />}>
<Menu className="size-5" />
</SheetTrigger>
<SheetContent side="right" className="gap-0">
<SheetHeader className="border-b border-border">
<SheetTitle>
<Logo />
</SheetTitle>
<SheetDescription className="sr-only">Pages on the Orbit site</SheetDescription>
</SheetHeader>
<nav aria-label="Main" className="flex-1 overflow-y-auto p-3">
<ul className="grid gap-1">
{LINKS.map((link) => (
<li key={link.href}>
<a
href={link.href}
onClick={() => setOpen(false)}
className={cn("flex h-11 items-center rounded-md px-3 text-base font-medium transition-colors hover:bg-muted", focusRing)}
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
<SheetFooter className="border-t border-border">
<Button variant="outline" size="lg" nativeButton={false} render={<a href="#sign-in" onClick={() => setOpen(false)} />}>
Sign in
</Button>
<Button size="lg" nativeButton={false} render={<a href="#start" onClick={() => setOpen(false)} />}>
Start free trial
</Button>
</SheetFooter>
</SheetContent>
</Sheet>
)
}
export function AnnouncementNavbar() {
const [showBar, setShowBar] = React.useState(true)
const [stuck, setStuck] = React.useState(false)
const sentinel = React.useRef<HTMLDivElement>(null)
const logo = React.useRef<HTMLAnchorElement>(null)
// The sentinel sits right above the header: once it scrolls out of view, the header is stuck.
React.useEffect(() => {
const el = sentinel.current
if (!el) return
const io = new IntersectionObserver(([entry]) => setStuck(!entry.isIntersecting && entry.boundingClientRect.top < 0))
io.observe(el)
return () => io.disconnect()
}, [])
return (
<>
{showBar ? (
<AnnouncementBar
onDismiss={() => {
// Keep it closed across visits by storing the announcement's id in a cookie or localStorage.
setShowBar(false)
logo.current?.focus()
}}
/>
) : null}
<div ref={sentinel} aria-hidden="true" className="h-px" />
<header
data-stuck={stuck || undefined}
className={cn(
"sticky top-0 z-40 -mt-px border-b border-transparent transition-[background-color,border-color,box-shadow] duration-200",
"data-stuck:border-border data-stuck:bg-background/95 data-stuck:shadow-sm data-stuck:backdrop-blur-md",
)}
>
<a
href="#content"
className={cn(
"sr-only rounded-md bg-background px-3 py-2 text-sm font-medium shadow-md ring-1 ring-border focus:not-sr-only focus:absolute focus:px-3 focus:py-2 focus:top-3 focus:left-3 focus:z-50",
focusRing,
)}
>
Skip to content
</a>
<div className="mx-auto flex h-16 max-w-6xl items-center gap-4 px-4 sm:px-6 lg:grid lg:grid-cols-[1fr_auto_1fr]">
<a ref={logo} href="#top" aria-label="Orbit home" className={cn("justify-self-start rounded-md", focusRing)}>
<Logo />
</a>
<nav aria-label="Main" className="hidden lg:block">
<ul className="flex items-center gap-1">
{LINKS.map((link) => (
<li key={link.href}>
<a
href={link.href}
className={cn("inline-flex h-9 items-center rounded-md px-3 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground", focusRing)}
>
{link.label}
</a>
</li>
))}
</ul>
</nav>
<div className="ml-auto flex items-center gap-2 lg:ml-0 lg:justify-self-end">
<Button variant="ghost" size="lg" className="hidden px-3 lg:inline-flex" nativeButton={false} render={<a href="#sign-in" />}>
Sign in
</Button>
<Button size="lg" className="px-3.5" nativeButton={false} render={<a href="#start" />}>
Start free trial
</Button>
<MobileMenu />
</div>
</div>
</header>
</>
)
}
export default function NavbarAnnouncement() {
return (
<div className="w-full bg-background text-foreground">
<AnnouncementNavbar />
<div id="content" tabIndex={-1} className="outline-none">
{/* The hero runs up behind the transparent header. */}
<section className="-mt-16 bg-muted/60 pt-16">
<div className="mx-auto max-w-6xl px-4 py-14 sm:px-6 sm:py-20">
<h2 className="max-w-2xl font-heading text-3xl font-semibold tracking-tight text-balance sm:text-4xl">Get paid without chasing anyone</h2>
<p className="mt-4 max-w-xl text-base leading-relaxed text-muted-foreground">
Orbit sends the invoice, follows up when it is late and tells you the moment it is paid. Scroll down and watch the navbar settle in.
</p>
<div className="mt-7 flex flex-wrap gap-3">
<Button size="lg" className="px-4" nativeButton={false} render={<a href="#start" />}>
Start free trial
</Button>
<Button size="lg" variant="outline" className="px-4" nativeButton={false} render={<a href="#tour" />}>
Take the tour
</Button>
</div>
</div>
</section>
<section aria-labelledby="announcement-features" className="mx-auto max-w-6xl px-4 py-14 sm:px-6">
<h3 id="announcement-features" className="font-heading text-xl font-semibold tracking-tight">
Made for studios of one to twenty
</h3>
<ul className="mt-6 grid gap-4 sm:grid-cols-3">
{FEATURES.map((f) => (
<li key={f.title} className="rounded-xl border border-border bg-card p-5 text-card-foreground">
<span className="flex size-9 items-center justify-center rounded-md border border-border bg-muted">
<f.icon className="size-4" aria-hidden="true" />
</span>
<p className="mt-4 text-sm font-semibold">{f.title}</p>
<p className="mt-1 text-sm leading-relaxed text-muted-foreground">{f.body}</p>
</li>
))}
</ul>
</section>
<section className="mx-auto max-w-6xl px-4 pb-16 sm:px-6">
<figure className="rounded-xl bg-muted/60 p-6 sm:p-8">
<blockquote className="max-w-2xl text-lg leading-relaxed text-balance">
“We used to spend Friday afternoons chasing invoices. Now Orbit does it, politely, and we spend Fridays on the work.”
</blockquote>
<figcaption className="mt-4 text-sm text-muted-foreground">Ada Lin, founder of Halden Studio</figcaption>
</figure>
</section>
</div>
</div>
)
}