itmpwk.ac.id/resources/js/components/nav-main.tsx
Yoga Pangestu 400e8d8c8a
Some checks failed
tests / ci (pull_request) Has been cancelled
feat: implement academic term management with CRUD functionality
- Added Semester enum with labels for odd and even semesters.
- Created AcademicTerm model, controller, service, and request for handling academic terms.
- Implemented paginated listing, creation, updating, and deletion of academic terms.
- Added routes for academic terms management under admin/master.
- Created frontend components for displaying and managing academic terms, including forms and data tables.
- Integrated confirmation dialog for delete actions and form dialogs for creating and editing academic terms.
- Added seeder for initial academic term data.
2026-08-05 13:48:36 +07:00

69 lines
1.7 KiB
TypeScript

"use client"
import {
SidebarGroup,
SidebarGroupLabel,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem
} from "@/components/ui/sidebar";
export type NavItem = {
name: string
url: string
icon: React.ComponentType<{ className?: string }>
}
export type NavGroup = {
label: string
items: NavItem[]
}
export function NavMain({
items,
}: {
items: (NavGroup | NavItem)[]
}) {
return (
<>
{items.map((item, index) => {
if ("label" in item) {
return (
<SidebarGroup key={item.label} className="group-data-[collapsible=icon]:hidden">
<SidebarGroupLabel>{item.label}</SidebarGroupLabel>
<SidebarMenu>
{item.items.map((child) => (
<SidebarMenuItem key={child.name}>
<SidebarMenuButton asChild>
<a href={child.url}>
<child.icon className="h-4 w-4" />
<span>{child.name}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroup>
)
}
return (
<SidebarGroup key={item.name} className="group-data-[collapsible=icon]:hidden">
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton asChild>
<a href={item.url}>
<item.icon className="h-4 w-4" />
<span>{item.name}</span>
</a>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
)
})}
</>
)
}