-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,026 changed files
with
55,407 additions
and
5,426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
apps/www/__registry__/default/block/demo-sidebar-controlled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
"use client" | ||
|
||
import * as React from "react" | ||
import { | ||
Frame, | ||
LifeBuoy, | ||
Map, | ||
PanelLeftClose, | ||
PanelLeftOpen, | ||
PieChart, | ||
Send, | ||
} from "lucide-react" | ||
|
||
import { Button } from "@/registry/default/ui/button" | ||
import { | ||
Sidebar, | ||
SidebarContent, | ||
SidebarGroup, | ||
SidebarGroupContent, | ||
SidebarGroupLabel, | ||
SidebarInset, | ||
SidebarMenu, | ||
SidebarMenuButton, | ||
SidebarMenuItem, | ||
SidebarProvider, | ||
} from "@/registry/default/ui/sidebar" | ||
|
||
const projects = [ | ||
{ | ||
name: "Design Engineering", | ||
url: "#", | ||
icon: Frame, | ||
}, | ||
{ | ||
name: "Sales & Marketing", | ||
url: "#", | ||
icon: PieChart, | ||
}, | ||
{ | ||
name: "Travel", | ||
url: "#", | ||
icon: Map, | ||
}, | ||
{ | ||
name: "Support", | ||
url: "#", | ||
icon: LifeBuoy, | ||
}, | ||
{ | ||
name: "Feedback", | ||
url: "#", | ||
icon: Send, | ||
}, | ||
] | ||
|
||
export default function AppSidebar() { | ||
const [open, setOpen] = React.useState(true) | ||
|
||
return ( | ||
<SidebarProvider open={open} onOpenChange={setOpen}> | ||
<Sidebar> | ||
<SidebarContent> | ||
<SidebarGroup> | ||
<SidebarGroupLabel>Projects</SidebarGroupLabel> | ||
<SidebarGroupContent> | ||
<SidebarMenu> | ||
{projects.map((project) => ( | ||
<SidebarMenuItem key={project.name}> | ||
<SidebarMenuButton asChild> | ||
<a href={project.url}> | ||
<project.icon /> | ||
<span>{project.name}</span> | ||
</a> | ||
</SidebarMenuButton> | ||
</SidebarMenuItem> | ||
))} | ||
</SidebarMenu> | ||
</SidebarGroupContent> | ||
</SidebarGroup> | ||
</SidebarContent> | ||
</Sidebar> | ||
<SidebarInset> | ||
<header className="flex items-center h-12 px-4 justify-between"> | ||
<Button | ||
onClick={() => setOpen((open) => !open)} | ||
size="sm" | ||
variant="ghost" | ||
> | ||
{open ? <PanelLeftClose /> : <PanelLeftOpen />} | ||
<span>{open ? "Close" : "Open"} Sidebar</span> | ||
</Button> | ||
</header> | ||
</SidebarInset> | ||
</SidebarProvider> | ||
) | ||
} |
66 changes: 66 additions & 0 deletions
66
apps/www/__registry__/default/block/demo-sidebar-footer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"use client" | ||
|
||
import { ChevronDown, ChevronUp, User2 } from "lucide-react" | ||
|
||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuTrigger, | ||
} from "@/registry/default/ui/dropdown-menu" | ||
import { | ||
Sidebar, | ||
SidebarContent, | ||
SidebarFooter, | ||
SidebarHeader, | ||
SidebarInset, | ||
SidebarMenu, | ||
SidebarMenuButton, | ||
SidebarMenuItem, | ||
SidebarProvider, | ||
SidebarTrigger, | ||
} from "@/registry/default/ui/sidebar" | ||
|
||
export default function AppSidebar() { | ||
return ( | ||
<SidebarProvider> | ||
<Sidebar> | ||
<SidebarHeader /> | ||
<SidebarContent /> | ||
<SidebarFooter> | ||
<SidebarMenu> | ||
<SidebarMenuItem> | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<SidebarMenuButton className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"> | ||
Username | ||
<ChevronUp className="ml-auto" /> | ||
</SidebarMenuButton> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent | ||
side="top" | ||
className="w-[--radix-popper-anchor-width]" | ||
> | ||
<DropdownMenuItem> | ||
<span>Account</span> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem> | ||
<span>Billing</span> | ||
</DropdownMenuItem> | ||
<DropdownMenuItem> | ||
<span>Sign out</span> | ||
</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
</SidebarMenuItem> | ||
</SidebarMenu> | ||
</SidebarFooter> | ||
</Sidebar> | ||
<SidebarInset> | ||
<header className="flex items-center justify-between px-4 h-12"> | ||
<SidebarTrigger /> | ||
</header> | ||
</SidebarInset> | ||
</SidebarProvider> | ||
) | ||
} |
Oops, something went wrong.