Skip to content

Commit

Permalink
feat(sidebar blocks): adds sidebar-16 block with components and styles (
Browse files Browse the repository at this point in the history
#5889)

Introduces a new sidebar-16 block with an inset sidebar and site header navigation.
Includes components for main navigation, projects, secondary navigation, and user menu.
Updates registry and scripts to include the new sidebar block.

Addresses: #5629

![image](https://github.com/user-attachments/assets/769148aa-ec83-46f4-b4f0-77947e253d28)
![image](https://github.com/user-attachments/assets/38532b4d-21f6-4ce1-9e92-08edc4f72e46)
  • Loading branch information
Jacksonmills authored Jan 27, 2025
1 parent ddf761e commit dd71498
Show file tree
Hide file tree
Showing 32 changed files with 4,068 additions and 8 deletions.
134 changes: 134 additions & 0 deletions apps/www/__registry__/default/block/sidebar-16/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
"use client"

import * as React from "react"
import { Command, Sidebar } from "lucide-react"

import { AppSidebar } from "@/registry/default/block/sidebar-16/components/app-sidebar"
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbLink,
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/registry/default/ui/breadcrumb"
import { Button } from "@/registry/default/ui/button"
import { Separator } from "@/registry/default/ui/separator"
import {
SidebarInset,
SidebarProvider,
SidebarTrigger,
} from "@/registry/default/ui/sidebar"

export const iframeHeight = "800px"

export const description = "An inset sidebar with site header navigation."

const HEADER_HEIGHT = "4rem"

export default function Page() {
const [open, setOpen] = React.useState(true)

return (
<div
style={
{
"--header-height": HEADER_HEIGHT,
} as React.CSSProperties
}
>
<header className="bg-sidebar sticky h-[--header-height] top-0 z-50 w-full border-b border-border/40 backdrop-blur">
<div className="flex h-14 items-center px-4">
<div className="mr-4 hidden md:flex">
<Button
className="hidden md:flex"
variant="ghost"
size="icon"
onClick={() => setOpen(!open)}
>
<Sidebar />
</Button>
<a href="#" className="mr-4 flex items-center gap-2 lg:mr-6">
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
<Command className="size-4" />
</div>
</a>
<nav className="flex items-center gap-4 text-sm xl:gap-6">
<a
href="#"
className="transition-colors hover:text-foreground/80"
>
Docs
</a>
<a
href="#"
className="transition-colors hover:text-foreground/80"
>
Components
</a>
<a
href="#"
className="transition-colors hover:text-foreground/80"
>
Blocks
</a>
<a
href="#"
className="transition-colors hover:text-foreground/80"
>
Charts
</a>
<a
href="#"
className="transition-colors hover:text-foreground/80"
>
Themes
</a>
<a
href="#"
className="transition-colors hover:text-foreground/80"
>
Colors
</a>
</nav>
</div>
</div>
</header>
<SidebarProvider open={open} onOpenChange={setOpen}>
<AppSidebar />

<SidebarInset>
<header className=" flex shrink-0 items-center gap-2 border-b py-2">
<div className="flex items-center gap-2 px-4 py-2">
<div className="flex md:hidden items-center gap-2">
<SidebarTrigger />
<Separator orientation="vertical" className="mr-2 h-4" />
</div>
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem className="hidden md:block">
<BreadcrumbLink href="#">
Building Your Application
</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator className="hidden md:block" />
<BreadcrumbItem>
<BreadcrumbPage>Data Fetching</BreadcrumbPage>
</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>
</div>
</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>
</div>
)
}
30 changes: 30 additions & 0 deletions apps/www/__registry__/default/blocks/sidebar-16/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { AppSidebar } from "@/registry/default/blocks/sidebar-16/components/app-sidebar"
import { SiteHeader } from "@/registry/default/blocks/sidebar-16/components/site-header"
import { SidebarInset, SidebarProvider } from "@/registry/default/ui/sidebar"

export const iframeHeight = "800px"

export const description = "A sidebar with a header and a search form."

export default function Page() {
return (
<div className="[--header-height:calc(theme(spacing.14))]">
<SidebarProvider className="flex flex-col">
<SiteHeader />
<div className="flex flex-1">
<AppSidebar />
<SidebarInset>
<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>
</div>
</SidebarProvider>
</div>
)
}
86 changes: 86 additions & 0 deletions apps/www/__registry__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,49 @@ export const Index: Record<string, any> = {
source: "__registry__/new-york/blocks/sidebar-15/page.tsx",
meta: undefined,
},
"sidebar-16": {
name: "sidebar-16",
description: "A sidebar with a sticky site header.",
type: "registry:block",
registryDependencies: ["sidebar","breadcrumb","separator","collapsible","dropdown-menu","avatar","button"],
files: [{
path: "registry/new-york/blocks/sidebar-16/page.tsx",
type: "registry:page",
target: "app/dashboard/page.tsx"
},{
path: "registry/new-york/blocks/sidebar-16/components/app-sidebar.tsx",
type: "registry:component",
target: ""
},{
path: "registry/new-york/blocks/sidebar-16/components/nav-main.tsx",
type: "registry:component",
target: ""
},{
path: "registry/new-york/blocks/sidebar-16/components/nav-projects.tsx",
type: "registry:component",
target: ""
},{
path: "registry/new-york/blocks/sidebar-16/components/nav-secondary.tsx",
type: "registry:component",
target: ""
},{
path: "registry/new-york/blocks/sidebar-16/components/nav-user.tsx",
type: "registry:component",
target: ""
},{
path: "registry/new-york/blocks/sidebar-16/components/search-form.tsx",
type: "registry:component",
target: ""
},{
path: "registry/new-york/blocks/sidebar-16/components/site-header.tsx",
type: "registry:component",
target: ""
}],
categories: ["sidebar","dashboard"],
component: React.lazy(() => import("@/registry/new-york/blocks/sidebar-16/page.tsx")),
source: "__registry__/new-york/blocks/sidebar-16/page.tsx",
meta: undefined,
},
"login-01": {
name: "login-01",
description: "A simple login form.",
Expand Down Expand Up @@ -6394,6 +6437,49 @@ export const Index: Record<string, any> = {
source: "__registry__/default/blocks/sidebar-15/page.tsx",
meta: undefined,
},
"sidebar-16": {
name: "sidebar-16",
description: "A sidebar with a sticky site header.",
type: "registry:block",
registryDependencies: ["sidebar","breadcrumb","separator","collapsible","dropdown-menu","avatar","button"],
files: [{
path: "registry/default/blocks/sidebar-16/page.tsx",
type: "registry:page",
target: "app/dashboard/page.tsx"
},{
path: "registry/default/blocks/sidebar-16/components/app-sidebar.tsx",
type: "registry:component",
target: ""
},{
path: "registry/default/blocks/sidebar-16/components/nav-main.tsx",
type: "registry:component",
target: ""
},{
path: "registry/default/blocks/sidebar-16/components/nav-projects.tsx",
type: "registry:component",
target: ""
},{
path: "registry/default/blocks/sidebar-16/components/nav-secondary.tsx",
type: "registry:component",
target: ""
},{
path: "registry/default/blocks/sidebar-16/components/nav-user.tsx",
type: "registry:component",
target: ""
},{
path: "registry/default/blocks/sidebar-16/components/search-form.tsx",
type: "registry:component",
target: ""
},{
path: "registry/default/blocks/sidebar-16/components/site-header.tsx",
type: "registry:component",
target: ""
}],
categories: ["sidebar","dashboard"],
component: React.lazy(() => import("@/registry/default/blocks/sidebar-16/page.tsx")),
source: "__registry__/default/blocks/sidebar-16/page.tsx",
meta: undefined,
},
"login-01": {
name: "login-01",
description: "A simple login form.",
Expand Down
Loading

0 comments on commit dd71498

Please sign in to comment.