fix(ui): объединить навигацию и сделать поиск доступным
This commit is contained in:
1 parent
9b3196363c
commit
fe9df167ec
6 files changed
+224
-353
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
useSidebar,
|
||||
} from "@/components/ui/sidebar"
|
||||
|
||||
export interface NavItem {
|
||||
@@ -25,9 +26,10 @@ export interface NavGroup {
|
||||
|
||||
export function NavMain({ groups }: { groups: NavGroup[] }) {
|
||||
const pathname = usePathname()
|
||||
const { setOpenMobile } = useSidebar()
|
||||
|
||||
return (
|
||||
<>
|
||||
<nav aria-label="Основная навигация">
|
||||
{groups.map((group) => (
|
||||
<SidebarGroup key={group.label}>
|
||||
<SidebarGroupLabel>{group.label}</SidebarGroupLabel>
|
||||
@@ -37,7 +39,7 @@ export function NavMain({ groups }: { groups: NavGroup[] }) {
|
||||
<SidebarMenuButton
|
||||
isActive={pathname === item.url}
|
||||
tooltip={item.title}
|
||||
render={<Link href={item.url} />}
|
||||
render={<Link href={item.url} aria-current={pathname === item.url ? "page" : undefined} onNavigate={() => setOpenMobile(false)} />}
|
||||
>
|
||||
{item.icon}
|
||||
<span>{item.title}</span>
|
||||
@@ -52,6 +54,6 @@ export function NavMain({ groups }: { groups: NavGroup[] }) {
|
||||
</SidebarMenu>
|
||||
</SidebarGroup>
|
||||
))}
|
||||
</>
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user