85 lines
2.5 KiB
TypeScript
85 lines
2.5 KiB
TypeScript
"use client"
|
|
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from "@/components/ui/dropdown-menu"
|
|
import {
|
|
SidebarGroup,
|
|
SidebarGroupLabel,
|
|
SidebarMenu,
|
|
SidebarMenuAction,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
useSidebar,
|
|
} from "@/components/ui/sidebar"
|
|
import { MoreHorizontalIcon, FolderIcon, ArrowRightIcon, Trash2Icon } from "lucide-react"
|
|
|
|
export function NavProjects({
|
|
projects,
|
|
}: {
|
|
projects: {
|
|
name: string
|
|
url: string
|
|
icon: React.ReactNode
|
|
}[]
|
|
}) {
|
|
const { isMobile } = useSidebar()
|
|
return (
|
|
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
|
<SidebarGroupLabel>Projects</SidebarGroupLabel>
|
|
<SidebarMenu>
|
|
{projects.map((item) => (
|
|
<SidebarMenuItem key={item.name}>
|
|
<SidebarMenuButton render={<a href={item.url} />}>
|
|
{item.icon}
|
|
<span>{item.name}</span>
|
|
</SidebarMenuButton>
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger
|
|
render={
|
|
<SidebarMenuAction
|
|
showOnHover
|
|
className="aria-expanded:bg-muted"
|
|
/>
|
|
}
|
|
>
|
|
<MoreHorizontalIcon />
|
|
<span className="sr-only">More</span>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent
|
|
className="w-48 rounded-lg"
|
|
side={isMobile ? "bottom" : "right"}
|
|
align={isMobile ? "end" : "start"}
|
|
>
|
|
<DropdownMenuItem>
|
|
<FolderIcon className="text-muted-foreground" />
|
|
<span>View Project</span>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem>
|
|
<ArrowRightIcon className="text-muted-foreground" />
|
|
<span>Share Project</span>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem>
|
|
<Trash2Icon className="text-muted-foreground" />
|
|
<span>Delete Project</span>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</SidebarMenuItem>
|
|
))}
|
|
<SidebarMenuItem>
|
|
<SidebarMenuButton className="text-sidebar-foreground/70">
|
|
<MoreHorizontalIcon className="text-sidebar-foreground/70" />
|
|
<span>More</span>
|
|
</SidebarMenuButton>
|
|
</SidebarMenuItem>
|
|
</SidebarMenu>
|
|
</SidebarGroup>
|
|
)
|
|
}
|