skl/resources/js/components/app-sidebar.tsx

113 lines
3.3 KiB
TypeScript

"use client";
import * as React from "react";
import {
Command,
Frame,
Home,
LifeBuoy,
Send,
SquareTerminal,
} from "lucide-react";
import { NavMain } from "@/components/nav-main";
import { NavSecondary } from "@/components/nav-secondary";
import { NavUser } from "@/components/nav-user";
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "@/components/ui/sidebar";
import { Link, usePage } from "@inertiajs/react";
import { PageProps } from "@/types";
const data = {
user: {
name: "shadcn",
email: "m@example.com",
avatar: "/avatars/shadcn.jpg",
},
navMain: [
{
title: "Dashboard",
url: "/dashboard",
icon: Home,
},
{
title: "Projects",
url: "#",
icon: SquareTerminal,
isActive: true,
items: [
{
title: "History",
url: "#",
},
],
},
{
title: "Design Engineering",
url: "#",
icon: Frame,
},
],
navSecondary: [
{
title: "Support",
url: "#",
icon: LifeBuoy,
},
{
title: "Feedback",
url: "#",
icon: Send,
},
],
};
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
const { auth } = usePage<PageProps>().props;
return (
<Sidebar variant="inset" {...props}>
<SidebarHeader>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton size="lg" asChild>
<Link href={route("dashboard")}>
<div className="flex aspect-square size-8 items-center justify-center rounded-lg text-sidebar-primary-foreground">
{/* <Command className="size-4" /> */}
<img
src="/assets/logo_skl.svg"
alt="Logo"
className="w-12 h-12 md:w-16 md:h-16"
/>
</div>
<div className="grid flex-1 text-left text-sm leading-tight">
<span className="truncate font-semibold">
SKL
</span>
<span className="truncate text-xs">
Status Ketaatan Lingkungan
</span>
</div>
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<NavMain items={data.navMain} />
<NavSecondary items={data.navSecondary} className="mt-auto" />
</SidebarContent>
<SidebarFooter>
<NavUser user={auth.user} />
</SidebarFooter>
</Sidebar>
);
}