docs-nav.tsx — ui Source File
Architecture documentation for docs-nav.tsx, a tsx file in the ui codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1273d0bf_53e4_2800_7b23_666a52cfde0e["docs-nav.tsx"] ba3d44f3_7b34_f9cc_6283_44817785c0df["link"] 1273d0bf_53e4_2800_7b23_666a52cfde0e --> ba3d44f3_7b34_f9cc_6283_44817785c0df f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"] 1273d0bf_53e4_2800_7b23_666a52cfde0e --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb 0f2652fe_536a_d362_981f_94cad3be1147["nav"] 1273d0bf_53e4_2800_7b23_666a52cfde0e --> 0f2652fe_536a_d362_981f_94cad3be1147 9416d7da_00df_60a8_615c_4b360d3b77f8["docs"] 1273d0bf_53e4_2800_7b23_666a52cfde0e --> 9416d7da_00df_60a8_615c_4b360d3b77f8 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 1273d0bf_53e4_2800_7b23_666a52cfde0e --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 style 1273d0bf_53e4_2800_7b23_666a52cfde0e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { SidebarNavItem } from "types/nav"
import { type DocsConfig } from "@/config/docs"
import { cn } from "@/lib/utils"
export function DocsNav({ config }: { config: DocsConfig }) {
const pathname = usePathname()
const items = config.sidebarNav
return items.length ? (
<div className="flex flex-col gap-6">
{items.map((item, index) => (
<div key={index} className="flex flex-col gap-1">
<h4 className="rounded-md px-2 py-1 text-sm font-medium">
{item.title}{" "}
{item.label && (
<span className="ml-2 rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs font-normal leading-none text-[#000000] no-underline group-hover:no-underline">
{item.label}
</span>
)}
</h4>
{item?.items?.length && (
<DocsNavItems items={item.items} pathname={pathname} />
)}
</div>
))}
</div>
) : null
}
function DocsNavItems({
items,
pathname,
}: {
items: SidebarNavItem[]
pathname: string | null
}) {
return items?.length ? (
<div className="grid grid-flow-row auto-rows-max gap-0.5 text-sm">
{items.map((item, index) =>
item.href && !item.disabled ? (
<Link
key={index}
href={item.href}
className={cn(
"group relative flex h-8 w-full items-center rounded-lg px-2 after:absolute after:inset-x-0 after:inset-y-[-2px] after:rounded-lg hover:bg-accent hover:text-accent-foreground ",
item.disabled && "cursor-not-allowed opacity-60",
pathname === item.href
? "bg-accent font-medium text-accent-foreground"
: "font-normal text-foreground"
)}
target={item.external ? "_blank" : ""}
rel={item.external ? "noreferrer" : ""}
>
{item.title}
{item.label && (
<span className="ml-2 rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs leading-none text-[#000000] no-underline group-hover:no-underline">
{item.label}
</span>
)}
</Link>
) : (
<span
key={index}
className={cn(
"flex w-full cursor-not-allowed items-center rounded-md p-2 text-muted-foreground hover:underline",
item.disabled && "cursor-not-allowed opacity-60"
)}
>
{item.title}
{item.label && (
<span className="ml-2 rounded-md bg-muted px-1.5 py-0.5 text-xs leading-none text-muted-foreground no-underline group-hover:no-underline">
{item.label}
</span>
)}
</span>
)
)}
</div>
) : null
}
Domain
Subdomains
Functions
Dependencies
- docs
- link
- nav
- navigation
- utils
Source
Frequently Asked Questions
What does docs-nav.tsx do?
docs-nav.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, UIPrimitives subdomain.
What functions are defined in docs-nav.tsx?
docs-nav.tsx defines 2 function(s): DocsNav, DocsNavItems.
What does docs-nav.tsx depend on?
docs-nav.tsx imports 5 module(s): docs, link, nav, navigation, utils.
Where is docs-nav.tsx in the architecture?
docs-nav.tsx is located at deprecated/www/components/docs-nav.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: deprecated/www/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free