71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import {
|
|
IconDashboard,
|
|
IconSettings,
|
|
} from '@tabler/icons-react';
|
|
import * as React from 'react';
|
|
|
|
import NixOSLogo from '@/assets/nixos.svg?react';
|
|
import { NavMain } from '@/components/nav-main';
|
|
import { NavSecondary } from '@/components/nav-secondary';
|
|
import {
|
|
Sidebar,
|
|
SidebarContent,
|
|
SidebarFooter,
|
|
SidebarHeader,
|
|
SidebarMenu,
|
|
SidebarMenuButton,
|
|
SidebarMenuItem,
|
|
} from '@/components/ui/sidebar';
|
|
import { NavUser } from './nav-user';
|
|
|
|
const data = {
|
|
user: {
|
|
name: 'shadcn',
|
|
email: 'm@example.com',
|
|
avatar: '/avatars/shadcn.jpg',
|
|
},
|
|
navMain: [
|
|
{
|
|
title: '工作台',
|
|
url: '/',
|
|
icon: IconDashboard,
|
|
},
|
|
],
|
|
navSecondary: [
|
|
{
|
|
title: '设置',
|
|
url: '#',
|
|
icon: IconSettings,
|
|
},
|
|
],
|
|
};
|
|
|
|
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
|
return (
|
|
<Sidebar collapsible="offcanvas" {...props}>
|
|
<SidebarHeader>
|
|
<SidebarMenu>
|
|
<SidebarMenuItem>
|
|
<SidebarMenuButton
|
|
asChild
|
|
className="data-[slot=sidebar-menu-button]:p-1.5!"
|
|
>
|
|
<a href="#">
|
|
<NixOSLogo />
|
|
<span className="text-base font-semibold">Nix CN CMS</span>
|
|
</a>
|
|
</SidebarMenuButton>
|
|
</SidebarMenuItem>
|
|
</SidebarMenu>
|
|
</SidebarHeader>
|
|
<SidebarContent>
|
|
<NavMain items={data.navMain} />
|
|
<NavSecondary items={data.navSecondary} className="mt-auto" />
|
|
</SidebarContent>
|
|
<SidebarFooter>
|
|
<NavUser />
|
|
</SidebarFooter>
|
|
</Sidebar>
|
|
);
|
|
}
|