Building blocks for content-driven sites.
Accordion script placeholder
Hidden content here
Hidden content here
Hidden content here
bunx bejamas@latest add navigation-headers-01src/components/blocks/navigation-headers-01/index.tsCopy
export { default as NavigationHeaders01 } from "./NavigationHeaders01.astro";src/components/blocks/navigation-headers-01/NavigationHeaders01.astroCopy
1---2import { Button } from "@/ui/button";3import {4 DropdownMenu,5 DropdownMenuContent,6 DropdownMenuTrigger,7} from "@/ui/dropdown-menu";8import { StickySurface } from "@/ui/sticky-surface";9
10interface MenuLink {11 label: string;12 description?: string;13 href: string;14}15
16interface Props {17 brand?: string;18 homeHref?: string;19 companyLinks?: MenuLink[];20 class?: string;21}22
23const defaultCompanyLinks: MenuLink[] = [24 {25 label: "About",26 description: "Read more about our company",27 href: "#about",28 },29 { label: "Team", description: "Meet our heroes", href: "#team" },30 { label: "Blog", description: "Read our latest news", href: "#blog" },31 { label: "Careers", description: "Join our team", href: "#careers" },32];33
34const {35 brand = "Acme",36 homeHref = "/",37 companyLinks = defaultCompanyLinks,38 class: className = "",39} = Astro.props as Props;40
41const menuLinkClass =42 "flex w-full flex-col rounded-lg px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none";43
44const surfaceClass = [45 "top-5 mx-auto h-16 max-w-5xl rounded-2xl px-5 group-[.is-stuck]/surface:max-w-2xl",46 "bg-background/80 backdrop-blur-md transition-[max-width,box-shadow] duration-300 ease-out",47 className,48]49 .filter(Boolean)50 .join(" ");51---52
53<StickySurface54 as="header"55 threshold="1rem"56 observeStuck57 effects={["elevate"]}58 class={surfaceClass}59 style="--stuck-shadow: var(--shadow-sm)"60>61 <nav62 aria-label="Primary"63 class="grid h-full grid-cols-[1fr_auto_1fr] items-center gap-4"64 >65 <a href={homeHref} class="text-lg font-semibold tracking-tight">{brand}</a>66
67 <ul class="hidden items-center gap-1 md:flex">68 <li><Button as="a" href={homeHref} variant="ghost">Home</Button></li>69 <li>70 <DropdownMenu>71 <DropdownMenuTrigger variant="ghost">Company</DropdownMenuTrigger>72 <DropdownMenuContent align="center" class="w-[30rem] p-2">73 <div class="grid grid-cols-12 gap-2">74 <ul class="col-span-5 grid content-start gap-1">75 {76 companyLinks.map((link) => (77 <li>78 <a href={link.href} class={menuLinkClass}>79 <span class="text-sm font-medium">{link.label}</span>80 {link.description && (81 <span class="text-xs text-muted-foreground">82 {link.description}83 </span>84 )}85 </a>86 </li>87 ))88 }89 </ul>90 <a91 href="#company"92 class="col-span-7 flex min-h-40 items-end rounded-lg bg-primary p-4 font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"93 >94 Our company95 </a>96 </div>97 </DropdownMenuContent>98 </DropdownMenu>99 </li>100 <li><Button as="a" href="#contact" variant="ghost">Contact</Button></li>101 </ul>102
103 <div class="ml-auto flex items-center gap-2">104 <DropdownMenu>105 <DropdownMenuTrigger106 variant="outline"107 class="md:hidden"108 aria-label="Open navigation menu">Menu</DropdownMenuTrigger109 >110 <DropdownMenuContent align="end" class="w-56 p-2">111 <ul class="grid gap-1">112 <li><a href={homeHref} class={menuLinkClass}>Home</a></li>113 {114 companyLinks.map((link) => (115 <li>116 <a href={link.href} class={menuLinkClass}>117 {link.label}118 </a>119 </li>120 ))121 }122 <li><a href="#contact" class={menuLinkClass}>Contact</a></li>123 </ul>124 </DropdownMenuContent>125 </DropdownMenu>126 <Button127 as="a"128 href="#login"129 variant="outline"130 class="hidden transition-all duration-300 ease-out sm:inline-flex group-[.is-stuck]/surface:opacity-0 group-[.is-stuck]/surface:blur-sm"131 >Log in</Button132 >133 <Button as="a" href="#contact">Get a demo</Button>134 </div>135 </nav>136</StickySurface>bunx bejamas@latest add navigation-headers-02src/components/blocks/navigation-headers-02/index.tsCopy
export { default as NavigationHeaders02 } from "./NavigationHeaders02.astro";src/components/blocks/navigation-headers-02/NavigationHeaders02.astroCopy
1---2import { Button } from "@/ui/button";3import {4 DropdownMenu,5 DropdownMenuContent,6 DropdownMenuTrigger,7} from "@/ui/dropdown-menu";8import { StickySurface } from "@/ui/sticky-surface";9
10interface NavLink {11 label: string;12 href: string;13}14
15interface Props {16 brand?: string;17 announcement?: string;18 announcementHref?: string;19 announcementLinkLabel?: string;20 homeHref?: string;21 links?: NavLink[];22 class?: string;23}24
25const defaultLinks: NavLink[] = [26 { label: "Home", href: "/" },27 { label: "Company", href: "#company" },28 { label: "Contact", href: "#contact" },29];30
31const {32 brand = "Acme",33 announcement = "New release available!",34 announcementHref = "#changelog",35 announcementLinkLabel = "See the changelog",36 homeHref = "/",37 links = defaultLinks,38 class: className = "",39} = Astro.props as Props;40
41const menuLinkClass =42 "flex w-full rounded-lg px-3 py-2 text-sm hover:bg-accent focus-visible:bg-accent focus-visible:outline-none";43---44
45<div class:list={["w-full", className]}>46 <div class="bg-muted px-4 py-3 text-center text-sm text-muted-foreground">47 {announcement}48 <a49 href={announcementHref}50 class="font-medium text-foreground underline underline-offset-4"51 >{announcementLinkLabel}</a52 >53 </div>54 <StickySurface55 as="header"56 effects={["line"]}57 threshold="1rem"58 observeStuck59 class="bg-background/95 backdrop-blur"60 >61 <nav62 aria-label="Primary"63 class="mx-auto flex h-16 max-w-6xl items-center gap-6 px-6"64 >65 <a href={homeHref} class="mr-auto text-lg font-semibold tracking-tight"66 >{brand}</a67 >68 <ul class="hidden items-center gap-1 md:flex">69 {70 links.map((link) => (71 <li>72 <Button as="a" href={link.href} variant="ghost">73 {link.label}74 </Button>75 </li>76 ))77 }78 </ul>79 <div class="flex items-center gap-2">80 <DropdownMenu>81 <DropdownMenuTrigger82 variant="outline"83 class="md:hidden"84 aria-label="Open navigation menu">Menu</DropdownMenuTrigger85 >86 <DropdownMenuContent align="end" class="w-48 p-2">87 <ul class="grid gap-1">88 {89 links.map((link) => (90 <li>91 <a href={link.href} class={menuLinkClass}>92 {link.label}93 </a>94 </li>95 ))96 }97 <li><a href="#login" class={menuLinkClass}>Log in</a></li>98 </ul>99 </DropdownMenuContent>100 </DropdownMenu>101 <Button102 as="a"103 href="#login"104 variant="outline"105 class="hidden transition-all duration-300 ease-out sm:inline-flex group-[.is-stuck]/surface:opacity-0 group-[.is-stuck]/surface:blur-sm"106 >Log in</Button107 >108 <Button as="a" href="#contact">Get a demo</Button>109 </div>110 </nav>111 </StickySurface>112</div>