Home / File/ version-switcher.tsx — ui Source File

version-switcher.tsx — ui Source File

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

File tsx ComponentRegistry UIPrimitives 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  0762d488_708d_a413_0f82_1258984a6132["version-switcher.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  0762d488_708d_a413_0f82_1258984a6132 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  ac307fe4_34c0_4667_089c_c9e7c15ca708["dropdown-menu"]
  0762d488_708d_a413_0f82_1258984a6132 --> ac307fe4_34c0_4667_089c_c9e7c15ca708
  f1a5091e_9f4f_a457_6394_4e05eb42bbf1["sidebar"]
  0762d488_708d_a413_0f82_1258984a6132 --> f1a5091e_9f4f_a457_6394_4e05eb42bbf1
  de6fac54_74ca_6c25_8f8b_d1ba3287dbf2["icon-placeholder"]
  0762d488_708d_a413_0f82_1258984a6132 --> de6fac54_74ca_6c25_8f8b_d1ba3287dbf2
  style 0762d488_708d_a413_0f82_1258984a6132 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"

import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@/registry/bases/base/ui/dropdown-menu"
import {
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
} from "@/registry/bases/base/ui/sidebar"
import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"

export function VersionSwitcher({
  versions,
  defaultVersion,
}: {
  versions: string[]
  defaultVersion: string
}) {
  const [selectedVersion, setSelectedVersion] = React.useState(defaultVersion)
  return (
    <SidebarMenu>
      <SidebarMenuItem>
        <DropdownMenu>
          <DropdownMenuTrigger
            render={
              <SidebarMenuButton
                size="lg"
                className="data-open:bg-sidebar-accent data-open:text-sidebar-accent-foreground"
              />
            }
          >
            <div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
              <IconPlaceholder
                lucide="GalleryVerticalEndIcon"
                tabler="IconLayoutRows"
                hugeicons="LayoutBottomIcon"
                phosphor="RowsIcon"
                remixicon="RiGalleryLine"
                className="size-4"
              />
            </div>
            <div className="flex flex-col gap-0.5 leading-none">
              <span className="font-medium">Documentation</span>
              <span className="">v{selectedVersion}</span>
            </div>
            <IconPlaceholder
              lucide="ChevronsUpDownIcon"
              tabler="IconSelector"
              hugeicons="UnfoldMoreIcon"
              phosphor="CaretUpDownIcon"
              remixicon="RiArrowUpDownLine"
              className="ml-auto"
            />
          </DropdownMenuTrigger>
          <DropdownMenuContent align="start">
            {versions.map((version) => (
              <DropdownMenuItem
                key={version}
                onSelect={() => setSelectedVersion(version)}
              >
                v{version}{" "}
                {version === selectedVersion && (
                  <IconPlaceholder
                    lucide="CheckIcon"
                    tabler="IconCheck"
                    hugeicons="Tick02Icon"
                    phosphor="CheckIcon"
                    remixicon="RiCheckLine"
                    className="ml-auto"
                  />
                )}
              </DropdownMenuItem>
            ))}
          </DropdownMenuContent>
        </DropdownMenu>
      </SidebarMenuItem>
    </SidebarMenu>
  )
}

Subdomains

Functions

Dependencies

  • dropdown-menu
  • icon-placeholder
  • react
  • sidebar

Frequently Asked Questions

What does version-switcher.tsx do?
version-switcher.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 version-switcher.tsx?
version-switcher.tsx defines 1 function(s): VersionSwitcher.
What does version-switcher.tsx depend on?
version-switcher.tsx imports 4 module(s): dropdown-menu, icon-placeholder, react, sidebar.
Where is version-switcher.tsx in the architecture?
version-switcher.tsx is located at apps/v4/registry/bases/base/blocks/sidebar-01/components/version-switcher.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: apps/v4/registry/bases/base/blocks/sidebar-01/components).

Analyze Your Own Codebase

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

Try Supermodel Free