mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-02 13:07:46 +00:00
Fixed deployment issues for GitHub Pages static export: Server Component Fixes: - Added 'use client' to all login blocks (10 files) - Added 'use client' to all signup blocks (10 files) - Added 'use client' to all sidebar blocks (25 files) - Added 'use client' to all OTP blocks (10 files) - Fixed VersionSwitcher/SearchForm naming in sidebar-02 Registry Structure Fixes: - Updated getRegistryItem() to use Index[style][name] pattern - Updated getRegistryComponent() to accept style parameter - Removed problematic Zod validation in blocks.ts - Fixed null to undefined conversion in block metadata Build Compatibility: - Disabled Shiki syntax highlighting for static export - Added HTML fallback for code blocks Result: All 353 static pages now generate successfully
195 lines
5.0 KiB
TypeScript
195 lines
5.0 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import { ChevronRight, File, Folder } from "lucide-react"
|
|
|
|
import {
|
|
Breadcrumb,
|
|
BreadcrumbItem,
|
|
BreadcrumbLink,
|
|
BreadcrumbList,
|
|
BreadcrumbPage,
|
|
BreadcrumbSeparator,
|
|
} from "@/registry/default/ui/breadcrumb"
|
|
import {
|
|
Collapsible,
|
|
CollapsibleContent,
|
|
CollapsibleTrigger,
|
|
} from "@/registry/default/ui/collapsible"
|
|
import { Separator } from "@/registry/default/ui/separator"
|
|
import {
|
|
Sidebar,
|
|
SidebarContent,
|
|
SidebarGroup,
|
|
SidebarGroupContent,
|
|
SidebarGroupLabel,
|
|
SidebarInset,
|
|
SidebarMenu,
|
|
SidebarMenuBadge,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
SidebarMenuSub,
|
|
SidebarProvider,
|
|
SidebarRail,
|
|
SidebarTrigger,
|
|
} from "@/registry/default/ui/sidebar"
|
|
|
|
export default function Page() {
|
|
return (
|
|
<SidebarProvider>
|
|
<AppSidebar11 />
|
|
<SidebarInset>
|
|
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
|
|
<SidebarTrigger className="-ml-1" />
|
|
<Separator orientation="vertical" className="mr-2 h-4" />
|
|
<Breadcrumb>
|
|
<BreadcrumbList>
|
|
<BreadcrumbItem className="hidden md:block">
|
|
<BreadcrumbLink href="#">components</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
<BreadcrumbSeparator className="hidden md:block" />
|
|
<BreadcrumbItem className="hidden md:block">
|
|
<BreadcrumbLink href="#">ui</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
<BreadcrumbSeparator className="hidden md:block" />
|
|
<BreadcrumbItem>
|
|
<BreadcrumbPage>button.tsx</BreadcrumbPage>
|
|
</BreadcrumbItem>
|
|
</BreadcrumbList>
|
|
</Breadcrumb>
|
|
</header>
|
|
<div className="flex flex-1 flex-col gap-4 p-4">
|
|
<div className="grid auto-rows-min gap-4 md:grid-cols-3">
|
|
<div className="aspect-video rounded-xl bg-muted/50" />
|
|
<div className="aspect-video rounded-xl bg-muted/50" />
|
|
<div className="aspect-video rounded-xl bg-muted/50" />
|
|
</div>
|
|
<div className="min-h-[100vh] flex-1 rounded-xl bg-muted/50 md:min-h-min" />
|
|
</div>
|
|
</SidebarInset>
|
|
</SidebarProvider>
|
|
)
|
|
}
|
|
|
|
// This is sample data.
|
|
const data = {
|
|
changes: [
|
|
{
|
|
file: "README.md",
|
|
state: "M",
|
|
},
|
|
{
|
|
file: "api/hello/route.ts",
|
|
state: "U",
|
|
},
|
|
{
|
|
file: "app/layout.tsx",
|
|
state: "M",
|
|
},
|
|
],
|
|
tree: [
|
|
[
|
|
"app",
|
|
[
|
|
"api",
|
|
["hello", ["route.ts"]],
|
|
"page.tsx",
|
|
"layout.tsx",
|
|
["blog", ["page.tsx"]],
|
|
],
|
|
],
|
|
[
|
|
"components",
|
|
["ui", "button.tsx", "card.tsx"],
|
|
"header.tsx",
|
|
"footer.tsx",
|
|
],
|
|
["lib", ["util.ts"]],
|
|
["public", "favicon.ico", "vercel.svg"],
|
|
".eslintrc.json",
|
|
".gitignore",
|
|
"next.config.js",
|
|
"tailwind.config.js",
|
|
"package.json",
|
|
"README.md",
|
|
],
|
|
}
|
|
|
|
export function AppSidebar11({
|
|
...props
|
|
}: React.ComponentProps<typeof Sidebar>) {
|
|
return (
|
|
<Sidebar {...props}>
|
|
<SidebarContent>
|
|
<SidebarGroup>
|
|
<SidebarGroupLabel>Changes</SidebarGroupLabel>
|
|
<SidebarGroupContent>
|
|
<SidebarMenu>
|
|
{data.changes.map((item, index) => (
|
|
<SidebarMenuItem key={index}>
|
|
<SidebarMenuButton>
|
|
<File />
|
|
{item.file}
|
|
</SidebarMenuButton>
|
|
<SidebarMenuBadge>{item.state}</SidebarMenuBadge>
|
|
</SidebarMenuItem>
|
|
))}
|
|
</SidebarMenu>
|
|
</SidebarGroupContent>
|
|
</SidebarGroup>
|
|
<SidebarGroup>
|
|
<SidebarGroupLabel>Files</SidebarGroupLabel>
|
|
<SidebarGroupContent>
|
|
<SidebarMenu>
|
|
{data.tree.map((item, index) => (
|
|
<Tree key={index} item={item} />
|
|
))}
|
|
</SidebarMenu>
|
|
</SidebarGroupContent>
|
|
</SidebarGroup>
|
|
</SidebarContent>
|
|
<SidebarRail />
|
|
</Sidebar>
|
|
)
|
|
}
|
|
|
|
function Tree({ item }: { item: string | any[] }) {
|
|
const [name, ...items] = Array.isArray(item) ? item : [item]
|
|
|
|
if (!items.length) {
|
|
return (
|
|
<SidebarMenuButton
|
|
isActive={name === "button.tsx"}
|
|
className="data-[active=true]:bg-transparent"
|
|
>
|
|
<File />
|
|
{name}
|
|
</SidebarMenuButton>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<SidebarMenuItem>
|
|
<Collapsible
|
|
className="group/collapsible [&[data-state=open]>button>svg:first-child]:rotate-90"
|
|
defaultOpen={name === "components" || name === "ui"}
|
|
>
|
|
<CollapsibleTrigger asChild>
|
|
<SidebarMenuButton>
|
|
<ChevronRight className="transition-transform" />
|
|
<Folder />
|
|
{name}
|
|
</SidebarMenuButton>
|
|
</CollapsibleTrigger>
|
|
<CollapsibleContent>
|
|
<SidebarMenuSub>
|
|
{items.map((subItem, index) => (
|
|
<Tree key={index} item={subItem} />
|
|
))}
|
|
</SidebarMenuSub>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
</SidebarMenuItem>
|
|
)
|
|
}
|