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

blocks-nav.tsx — ui Source File

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

File tsx ComponentRegistry UIPrimitives 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  768b46f7_e79c_41ca_561a_e511d2500870["blocks-nav.tsx"]
  ba3d44f3_7b34_f9cc_6283_44817785c0df["link"]
  768b46f7_e79c_41ca_561a_e511d2500870 --> ba3d44f3_7b34_f9cc_6283_44817785c0df
  f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"]
  768b46f7_e79c_41ca_561a_e511d2500870 --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb
  87012fb0_00c6_7ce4_2418_e4e3b26e5dac["scroll-area"]
  768b46f7_e79c_41ca_561a_e511d2500870 --> 87012fb0_00c6_7ce4_2418_e4e3b26e5dac
  3d43044d_d1e0_5292_34f2_f76f2ab62f7c["registry-categories"]
  768b46f7_e79c_41ca_561a_e511d2500870 --> 3d43044d_d1e0_5292_34f2_f76f2ab62f7c
  style 768b46f7_e79c_41ca_561a_e511d2500870 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

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

import { ScrollArea, ScrollBar } from "@/registry/new-york/ui/scroll-area"
import { registryCategories } from "@/registry/registry-categories"

export function BlocksNav() {
  const pathname = usePathname()

  return (
    <div className="relative overflow-hidden">
      <ScrollArea className="max-w-none">
        <div className="flex items-center">
          <BlocksNavLink
            category={{ name: "Featured", slug: "", hidden: false }}
            isActive={pathname === "/blocks"}
          />
          {registryCategories.map((category) => (
            <BlocksNavLink
              key={category.slug}
              category={category}
              isActive={pathname === `/blocks/${category.slug}`}
            />
          ))}
        </div>
        <ScrollBar orientation="horizontal" className="invisible" />
      </ScrollArea>
    </div>
  )
}

function BlocksNavLink({
  category,
  isActive,
}: {
  category: (typeof registryCategories)[number]
  isActive: boolean
}) {
  if (category.hidden) {
    return null
  }

  return (
    <Link
      href={`/blocks/${category.slug}`}
      key={category.slug}
      className="flex h-7 shrink-0 items-center justify-center whitespace-nowrap rounded-full px-4 text-center text-sm font-medium text-muted-foreground transition-colors hover:text-foreground data-[active=true]:bg-muted data-[active=true]:text-foreground"
      data-active={isActive}
    >
      {category.name}
    </Link>
  )
}

Subdomains

Dependencies

  • link
  • navigation
  • registry-categories
  • scroll-area

Frequently Asked Questions

What does blocks-nav.tsx do?
blocks-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 blocks-nav.tsx?
blocks-nav.tsx defines 2 function(s): BlocksNav, BlocksNavLink.
What does blocks-nav.tsx depend on?
blocks-nav.tsx imports 4 module(s): link, navigation, registry-categories, scroll-area.
Where is blocks-nav.tsx in the architecture?
blocks-nav.tsx is located at deprecated/www/components/blocks-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