Home / File/ examples-nav.tsx — ui Source File

examples-nav.tsx — ui Source File

Architecture documentation for examples-nav.tsx, a tsx file in the ui codebase. 4 imports, 0 dependents.

File tsx Internationalization Dictionary 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  ab003c5d_c16d_30b1_977c_3bb1481a4b49["examples-nav.tsx"]
  ba3d44f3_7b34_f9cc_6283_44817785c0df["link"]
  ab003c5d_c16d_30b1_977c_3bb1481a4b49 --> ba3d44f3_7b34_f9cc_6283_44817785c0df
  f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"]
  ab003c5d_c16d_30b1_977c_3bb1481a4b49 --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  ab003c5d_c16d_30b1_977c_3bb1481a4b49 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  47fa1d7a_8370_cd8e_01f5_44e7f16431cc["scroll-area"]
  ab003c5d_c16d_30b1_977c_3bb1481a4b49 --> 47fa1d7a_8370_cd8e_01f5_44e7f16431cc
  style ab003c5d_c16d_30b1_977c_3bb1481a4b49 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import Link from "next/link"
import { usePathname } from "next/navigation"

import { cn } from "@/lib/utils"
import { ScrollArea, ScrollBar } from "@/registry/new-york-v4/ui/scroll-area"

const examples = [
  {
    name: "Dashboard",
    href: "/examples/dashboard",
    code: "https://github.com/shadcn/ui/tree/main/apps/v4/app/(app)/examples/dashboard",
    hidden: false,
  },
  {
    name: "Tasks",
    href: "/examples/tasks",
    code: "https://github.com/shadcn/ui/tree/main/apps/v4/app/(app)/examples/tasks",
    hidden: false,
  },
  {
    name: "Playground",
    href: "/examples/playground",
    code: "https://github.com/shadcn/ui/tree/main/apps/v4/app/(app)/examples/playground",
    hidden: false,
  },
  {
    name: "Authentication",
    href: "/examples/authentication",
    code: "https://github.com/shadcn/ui/tree/main/apps/v4/app/(app)/examples/authentication",
    hidden: false,
  },
  {
    name: "RTL",
    href: "/examples/rtl",
    code: "https://github.com/shadcn/ui/tree/main/apps/v4/app/(app)/examples/rtl",
    hidden: false,
  },
]

export function ExamplesNav({
  className,
  ...props
}: React.ComponentProps<"div">) {
  const pathname = usePathname()

  return (
    <div className={cn("flex items-center", className)} {...props}>
      <ScrollArea className="max-w-[96%] md:max-w-[600px] lg:max-w-none">
        <div className="flex items-center">
          <ExampleLink
            example={{ name: "Examples", href: "/", code: "", hidden: false }}
            isActive={pathname === "/"}
          />
          {examples.map((example) => (
            <ExampleLink
              key={example.href}
              example={example}
              isActive={pathname?.startsWith(example.href) ?? false}
            />
          ))}
        </div>
        <ScrollBar orientation="horizontal" className="invisible" />
      </ScrollArea>
    </div>
  )
}

function ExampleLink({
  example,
  isActive,
}: {
  example: (typeof examples)[number]
  isActive: boolean
}) {
  if (example.hidden) {
    return null
  }

  return (
    <Link
      href={example.href}
      key={example.href}
      className="text-muted-foreground hover:text-primary data-[active=true]:text-primary flex h-7 items-center justify-center gap-2 px-4 text-center text-base font-medium transition-colors"
      data-active={isActive}
    >
      {example.name}
      {example.name === "RTL" && (
        <span className="flex size-2 rounded-full bg-blue-500" title="New" />
      )}
    </Link>
  )
}

Subdomains

Dependencies

  • link
  • navigation
  • scroll-area
  • utils

Frequently Asked Questions

What does examples-nav.tsx do?
examples-nav.tsx is a source file in the ui codebase, written in tsx. It belongs to the Internationalization domain, Dictionary subdomain.
What functions are defined in examples-nav.tsx?
examples-nav.tsx defines 2 function(s): ExampleLink, ExamplesNav.
What does examples-nav.tsx depend on?
examples-nav.tsx imports 4 module(s): link, navigation, scroll-area, utils.
Where is examples-nav.tsx in the architecture?
examples-nav.tsx is located at apps/v4/components/examples-nav.tsx (domain: Internationalization, subdomain: Dictionary, directory: apps/v4/components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free