AppSidebar.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { Link } from '@inertiajs/react';
  2. import { BookOpen, Folder, LayoutGrid } from 'lucide-react';
  3. import { AppLogo } from '@/common/AppLogo';
  4. import { NavFooter } from '@/common/NavFooter';
  5. import { NavMain } from '@/common/NavMain';
  6. import { NavUser } from '@/common/NavUser';
  7. import { type NavItem } from '@/common/types';
  8. import { dashboard } from '@/routes';
  9. import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem } from '@/shadcn/sidebar';
  10. const mainNavItems: NavItem[] = [
  11. {
  12. title: 'Dashboard',
  13. href: dashboard(),
  14. icon: LayoutGrid,
  15. },
  16. ];
  17. const footerNavItems: NavItem[] = [
  18. {
  19. title: 'Repository',
  20. href: 'https://github.com/laravel/react-starter-kit',
  21. icon: Folder,
  22. },
  23. {
  24. title: 'Documentation',
  25. href: 'https://laravel.com/docs/starter-kits#react',
  26. icon: BookOpen,
  27. },
  28. ];
  29. export function AppSidebar() {
  30. return (
  31. <Sidebar collapsible="icon" variant="inset">
  32. <SidebarHeader>
  33. <SidebarMenu>
  34. <SidebarMenuItem>
  35. <SidebarMenuButton size="lg" asChild>
  36. <Link href={dashboard()} prefetch>
  37. <AppLogo />
  38. </Link>
  39. </SidebarMenuButton>
  40. </SidebarMenuItem>
  41. </SidebarMenu>
  42. </SidebarHeader>
  43. <SidebarContent>
  44. <NavMain items={mainNavItems} />
  45. </SidebarContent>
  46. <SidebarFooter>
  47. <NavFooter items={footerNavItems} className="mt-auto" />
  48. <NavUser />
  49. </SidebarFooter>
  50. </Sidebar>
  51. );
  52. }