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 ChartRegistry 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  9fe5df5d_c9ac_85d6_e236_f18070711052["version-switcher.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  9fe5df5d_c9ac_85d6_e236_f18070711052 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  8001cb6e_41cc_4789_e2c4_6c9b6b1cc0bb["dropdown-menu"]
  9fe5df5d_c9ac_85d6_e236_f18070711052 --> 8001cb6e_41cc_4789_e2c4_6c9b6b1cc0bb
  1fee781a_1910_afaa_bb29_21305eb0ae61["sidebar"]
  9fe5df5d_c9ac_85d6_e236_f18070711052 --> 1fee781a_1910_afaa_bb29_21305eb0ae61
  de6fac54_74ca_6c25_8f8b_d1ba3287dbf2["icon-placeholder"]
  9fe5df5d_c9ac_85d6_e236_f18070711052 --> de6fac54_74ca_6c25_8f8b_d1ba3287dbf2
  style 9fe5df5d_c9ac_85d6_e236_f18070711052 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/radix/ui/dropdown-menu"
import {
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
} from "@/registry/bases/radix/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 asChild>
            <SidebarMenuButton
              size="lg"
              className="data-[state=open]:bg-sidebar-accent data-[state=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"
              />
            </SidebarMenuButton>
          </DropdownMenuTrigger>
          <DropdownMenuContent
            className="w-(--radix-dropdown-menu-trigger-width)"
            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, ChartRegistry 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/radix/blocks/sidebar-02/components/version-switcher.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: apps/v4/registry/bases/radix/blocks/sidebar-02/components).

Analyze Your Own Codebase

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

Try Supermodel Free