lms/resources/js/layouts/dashboard/sidebar.tsx
Ahmed Darrazi c00f58bced
All checks were successful
Build & Push Docker Image / docker (push) Successful in 1m48s
Optimize mobile load by lazy loading large modules
2025-12-18 15:23:00 +01:00

39 lines
1.4 KiB
TypeScript

import AppLogo from '@/components/app-logo';
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuItem, useSidebar } from '@/components/ui/sidebar';
import { useIsMobile } from '@/hooks/use-mobile';
import { NavMain } from '@/layouts/dashboard/partials/nav-main';
import { NavUser } from '@/layouts/dashboard/partials/nav-user';
import { SharedData } from '@/types/global';
import { Link, usePage } from '@inertiajs/react';
const DashboardSidebar = () => {
const { state } = useSidebar();
const { props } = usePage<SharedData>();
const compact = state === 'collapsed' ? true : false;
const isMobile = useIsMobile();
return (
<Sidebar collapsible="icon" variant="inset" side={props.direction === 'rtl' ? 'right' : 'left'} className="shadow-md">
{!compact && (
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem className="pt-1 pb-5">
<Link href="/" prefetch={!isMobile}>
<AppLogo className="h-[26px]" />
</Link>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
)}
<SidebarContent>
<NavMain />
</SidebarContent>
<SidebarFooter>
<NavUser />
</SidebarFooter>
</Sidebar>
);
};
export default DashboardSidebar;