MCPcopy Create free account
hub / github.com/arctic-cli/interface / Sidebar

Function Sidebar

packages/web/components/ui/sidebar.tsx:142–239  ·  view source on GitHub ↗
({
  side = "left",
  variant = "sidebar",
  collapsible = "offcanvas",
  className,
  children,
  ...props
}: React.ComponentProps<"div"> & {
  side?: "left" | "right"
  variant?: "sidebar" | "floating" | "inset"
  collapsible?: "offcanvas" | "icon" | "none"
})

Source from the content-addressed store, hash-verified

140}
141
142function Sidebar({
143 side = "left",
144 variant = "sidebar",
145 collapsible = "offcanvas",
146 className,
147 children,
148 ...props
149}: React.ComponentProps<"div"> & {
150 side?: "left" | "right"
151 variant?: "sidebar" | "floating" | "inset"
152 collapsible?: "offcanvas" | "icon" | "none"
153}) {
154 const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
155
156 if (collapsible === "none") {
157 return (
158 <div
159 className={cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className)}
160 data-slot="sidebar"
161 {...props}
162 >
163 {children}
164 </div>
165 )
166 }
167
168 if (isMobile) {
169 return (
170 <Sheet onOpenChange={setOpenMobile} open={openMobile} {...props}>
171 <SheetPopup
172 className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
173 data-mobile="true"
174 data-sidebar="sidebar"
175 data-slot="sidebar"
176 side={side}
177 style={
178 {
179 "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
180 } as React.CSSProperties
181 }
182 >
183 <SheetHeader className="sr-only">
184 <SheetTitle>Sidebar</SheetTitle>
185 <SheetDescription>Displays the mobile sidebar.</SheetDescription>
186 </SheetHeader>
187 <div className="flex h-full w-full flex-col">{children}</div>
188 </SheetPopup>
189 </Sheet>
190 )
191 }
192
193 return (
194 <div
195 className="group peer hidden text-sidebar-foreground md:block"
196 data-collapsible={state === "collapsed" ? collapsible : ""}
197 data-side={side}
198 data-slot="sidebar"
199 data-state={state}

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useSidebarFunction · 0.85

Tested by

no test coverage detected