/
tsps
/
lk
Обзор
Документация
Войти
/
tsps
/
lk
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
src/components/layout/AppSidebar.tsx
74 строки
2 KB
Василий Петров
Просмотр аудиозаписей
25 мар 2026, 11:38
25 мар 2026, 11:38
03c6229
Код
Авторство
О чём код?
import { NavLink, useLocation } from "react-router-dom"; import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "@/components/ui/sidebar"; import { LayoutDashboard, Scale, NotebookText, AudioLines, } from "lucide-react"; const navigationItems = [ { title: "Главная", url: "/dashboard", icon: LayoutDashboard }, { title: "Документы", url: "/documents", icon: NotebookText }, { title: "Аудиозаписи", url: "/audio-recordings", icon: AudioLines }, ]; export function AppSidebar() { const { state } = useSidebar(); const collapsed = state === "collapsed"; const location = useLocation(); const currentPath = location.pathname; const isActive = (path: string) => currentPath === path; return ( <Sidebar className="border-r border-border bg-card"> <SidebarContent> {/* Logo/Brand */} <div className="p-4 border-b"> <div className="flex items-center gap-3"> <div className="w-8 h-8 judicial-gradient rounded-lg flex items-center justify-center"> <Scale className="h-5 w-5 text-white" /> </div> {!collapsed && ( <div> <h2 className="font-semibold text-judicial-navy">Цифровой Помощник Судьи</h2> </div> )} </div> </div> <SidebarGroup> <SidebarGroupLabel>Навигация</SidebarGroupLabel> <SidebarGroupContent> <SidebarMenu> {navigationItems.map((item) => ( <SidebarMenuItem key={item.title}> <SidebarMenuButton asChild isActive={isActive(item.url)}> <NavLink to={item.url} className="flex items-center gap-3 w-full legal-transition" > <item.icon className="h-5 w-5" /> {!collapsed && <span>{item.title}</span>} </NavLink> </SidebarMenuButton> </SidebarMenuItem> ))} </SidebarMenu> </SidebarGroupContent> </SidebarGroup> </SidebarContent> </Sidebar> ); }