mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 12:28:22 +00:00
87 lines
2.3 KiB
TypeScript
87 lines
2.3 KiB
TypeScript
'use client';
|
|
|
|
import Link from 'next/link';
|
|
import {
|
|
FolderIcon,
|
|
MoreHorizontalIcon,
|
|
ShareIcon,
|
|
type LucideIcon,
|
|
} from 'lucide-react';
|
|
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from '@/components/ui/dropdown-menu';
|
|
import {
|
|
SidebarGroup,
|
|
SidebarGroupLabel,
|
|
SidebarMenu,
|
|
SidebarMenuAction,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
useSidebar,
|
|
} from '@/components/ui/sidebar';
|
|
|
|
export function NavDocuments({
|
|
items,
|
|
}: {
|
|
items: {
|
|
name: string;
|
|
url: string;
|
|
icon: LucideIcon;
|
|
}[];
|
|
}) {
|
|
const { isMobile } = useSidebar();
|
|
|
|
return (
|
|
<SidebarGroup className='group-data-[collapsible=icon]:hidden'>
|
|
<SidebarGroupLabel>Documents</SidebarGroupLabel>
|
|
<SidebarMenu>
|
|
{items.map((item) => (
|
|
<SidebarMenuItem key={item.name}>
|
|
<SidebarMenuButton asChild>
|
|
<Link href={item.url}>
|
|
<item.icon />
|
|
<span>{item.name}</span>
|
|
</Link>
|
|
</SidebarMenuButton>
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<SidebarMenuAction
|
|
showOnHover
|
|
className='data-[state=open]:bg-accent rounded-sm'
|
|
>
|
|
<MoreHorizontalIcon />
|
|
<span className='sr-only'>More</span>
|
|
</SidebarMenuAction>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent
|
|
className='w-24 rounded-lg'
|
|
side={isMobile ? 'bottom' : 'right'}
|
|
align={isMobile ? 'end' : 'start'}
|
|
>
|
|
<DropdownMenuItem>
|
|
<FolderIcon />
|
|
<span>Open</span>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem>
|
|
<ShareIcon />
|
|
<span>Share</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>
|
|
);
|
|
}
|