chore: scaffold turbo monorepo with hono api and react admin web
This commit is contained in:
78
apps/web/src/components/layout/app-sidebar.tsx
Normal file
78
apps/web/src/components/layout/app-sidebar.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
import { Link, useRouterState } from '@tanstack/react-router'
|
||||
import { LayoutDashboardIcon, ListTodoIcon, SettingsIcon } from 'lucide-react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
|
||||
import { NavUser } from '@/components/layout/nav-user'
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
SidebarFooter,
|
||||
SidebarGroup,
|
||||
SidebarGroupLabel,
|
||||
SidebarHeader,
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
SidebarRail,
|
||||
} from '@/components/ui/sidebar'
|
||||
|
||||
type NavItem = {
|
||||
title: string
|
||||
to: string
|
||||
icon: LucideIcon
|
||||
}
|
||||
|
||||
const NAV_ITEMS: NavItem[] = [
|
||||
{ title: 'Dashboard', to: '/', icon: LayoutDashboardIcon },
|
||||
{ title: 'Tasks', to: '/tasks', icon: ListTodoIcon },
|
||||
{ title: 'Settings', to: '/settings', icon: SettingsIcon },
|
||||
]
|
||||
|
||||
export function AppSidebar() {
|
||||
const pathname = useRouterState({ select: (state) => state.location.pathname })
|
||||
|
||||
return (
|
||||
<Sidebar collapsible="icon">
|
||||
<SidebarHeader>
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton size="lg" asChild>
|
||||
<Link to="/">
|
||||
<div className="bg-primary text-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg text-sm font-semibold">
|
||||
SL
|
||||
</div>
|
||||
<div className="grid flex-1 text-left text-sm leading-tight">
|
||||
<span className="truncate font-medium">Superlist</span>
|
||||
<span className="text-muted-foreground truncate text-xs">Admin</span>
|
||||
</div>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu>
|
||||
</SidebarHeader>
|
||||
|
||||
<SidebarContent>
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Platform</SidebarGroupLabel>
|
||||
<SidebarMenu>
|
||||
{NAV_ITEMS.map((item) => (
|
||||
<SidebarMenuItem key={item.to}>
|
||||
<SidebarMenuButton asChild isActive={pathname === item.to} tooltip={item.title}>
|
||||
<Link to={item.to}>
|
||||
<item.icon />
|
||||
<span>{item.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
|
||||
<SidebarFooter>
|
||||
<NavUser />
|
||||
</SidebarFooter>
|
||||
<SidebarRail />
|
||||
</Sidebar>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user