Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions app/docs/components/navigation-menu/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { Metadata } from "next"

import { navigationMenuMetaData } from "@/lib/metadata"
import { Separator } from "@/components/ui/separator"
import NavigationMenuDemo from "@/components/examples/navigation-menu"

import CodeSnippet from "../code-snippet"
import CopyCommandButton from "../copy-command-button"
import InstallationCommands from "../installation-commands"
import { OpenInV0Button } from "../open-in-v0-button"

export const metadata: Metadata = {
title: "8-bit Navigation Menu",
description: "Displays an 8-bit navigation menu component.",
openGraph: {
images: navigationMenuMetaData,
},
}

export default function NavigationMenuPage() {
return (
<div className="flex flex-col gap-4">
<div className="flex flex-col md:flex-row items-center justify-between gap-2">
<h1 className="text-3xl font-bold">Navigation Menu</h1>
<CopyCommandButton
copyCommand={`pnpm dlx shadcn@canary add ${process.env.NEXT_PUBLIC_BASE_URL}/r/8bit-navigation-menu.json`}
command={"pnpm dlx shadcn@canary add 8bit-navigation-menu"}
/>
</div>

<p className="text-muted-foreground">
Displays an 8-bit navigation menu component.
</p>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
8-bit navigation menu component
</h2>

<div className="flex items-center gap-2">
<OpenInV0Button name="8bit-navigation-menu" className="w-fit" />
</div>
</div>
<div className="flex items-center justify-center min-h-[400px] relative space-x-2">
<NavigationMenuDemo />
</div>
</div>

<h3 className="text-lg font-bold">Installation</h3>

<Separator />

<InstallationCommands
packageUrl={`${process.env.NEXT_PUBLIC_BASE_URL}/r/8bit-navigation-menu.json`}
/>

<h3 className="text-lg font-bold mt-10">Usage</h3>

<Separator />

<CodeSnippet>{`import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuIndicator,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
NavigationMenuViewport,
} from "@/components/ui/8bit/navigation-menu"
`}</CodeSnippet>

<CodeSnippet>{`<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Item One</NavigationMenuTrigger>
<NavigationMenuContent>
<NavigationMenuLink>Link</NavigationMenuLink>
</NavigationMenuContent>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>
`}</CodeSnippet>
</div>
)
}
139 changes: 139 additions & 0 deletions components/examples/navigation-menu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
"use client"

import * as React from "react"
import Link from "next/link"

import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuIndicator,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from "@/components/ui/8bit/navigation-menu"

const components: { title: string; href: string; description: string }[] = [
{
title: "Alert Dialog",
href: "/docs/components/alert-dialog",
description:
"A modal dialog that interrupts the user with important content and expects a response.",
},
{
title: "Hover Card",
href: "/docs/components/hover-card",
description:
"For sighted users to preview content available behind a link.",
},
{
title: "Progress",
href: "/docs/components/progress",
description:
"Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.",
},
{
title: "Scroll-area",
href: "/docs/components/scroll-area",
description:
"Augments native scroll functionality for custom, cross-browser styling.",
},
{
title: "Tabs",
href: "/docs/components/tabs",
description:
"A set of layered sections of content—known as tab panels—that are displayed one at a time.",
},
{
title: "Tooltip",
href: "/docs/components/tooltip",
description:
"A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.",
},
]

export default function NavigationMenuDemo() {
return (
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Getting started</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid gap-2 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]">
<li className="row-span-3">
<NavigationMenuLink asChild>
<Link
className="from-muted/50 to-muted flex h-full w-full flex-col justify-end rounded-md bg-linear-to-b p-6 no-underline outline-hidden select-none focus:shadow-md"
href="/"
>
<div className="mt-4 mb-2 text-lg font-medium">
8bitcn/ui
</div>
<p className="text-muted-foreground text-sm leading-tight">
Beautifully designed components built with Tailwind CSS.
</p>
</Link>
</NavigationMenuLink>
</li>
<ListItem href="/docs" title="Installation">
How to install dependencies and structure your app.
</ListItem>
<ListItem href="/docs/components/accordion" title="Components">
Re-usable components built using Radix UI and Tailwind CSS.
</ListItem>
<ListItem href="/blocks" title="Building Blocks">
Building Retro Blocks for the Web
</ListItem>
</ul>
</NavigationMenuContent>
</NavigationMenuItem>

<NavigationMenuItem>
<NavigationMenuTrigger>Components</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid w-[400px] gap-2 md:w-[500px] md:grid-cols-2 lg:w-[600px]">
{components.map((component) => (
<ListItem
key={component.title}
title={component.title}
href={component.href}
>
{component.description}
</ListItem>
))}
</ul>
</NavigationMenuContent>
</NavigationMenuItem>

<NavigationMenuItem>
<NavigationMenuLink asChild className={navigationMenuTriggerStyle()}>
<Link href="/docs">Documentation</Link>
</NavigationMenuLink>
</NavigationMenuItem>

<NavigationMenuIndicator />
</NavigationMenuList>
</NavigationMenu>
)
}

function ListItem({
title,
children,
href,
...props
}: React.ComponentPropsWithoutRef<"li"> & { href: string }) {
return (
<li {...props}>
<NavigationMenuLink asChild>
<Link href={href}>
<div className="text-sm leading-none font-medium">{title}</div>
<p className="text-muted-foreground line-clamp-2 text-sm leading-snug">
{children}
</p>
</Link>
</NavigationMenuLink>
</li>
)
}
Loading