feat(KAN-19): add responsive permission-aware navigation
This commit is contained in:
@@ -12,23 +12,46 @@ import type { NavItem } from '@/types';
|
||||
|
||||
defineProps<{
|
||||
items: NavItem[];
|
||||
label: string;
|
||||
}>();
|
||||
|
||||
const { isCurrentUrl } = useCurrentUrl();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<SidebarGroup class="px-2 py-0">
|
||||
<SidebarGroupLabel>Platform</SidebarGroupLabel>
|
||||
<SidebarMenu>
|
||||
<SidebarGroup class="px-3 py-2">
|
||||
<SidebarGroupLabel class="text-label text-muted-foreground uppercase">{{
|
||||
label
|
||||
}}</SidebarGroupLabel>
|
||||
<SidebarMenu role="list" :aria-label="label">
|
||||
<SidebarMenuItem v-for="item in items" :key="item.title">
|
||||
<SidebarMenuButton
|
||||
as-child
|
||||
:is-active="isCurrentUrl(item.href)"
|
||||
:is-active="
|
||||
item.isActive ??
|
||||
isCurrentUrl(
|
||||
item.href,
|
||||
undefined,
|
||||
item.match === 'section',
|
||||
)
|
||||
"
|
||||
:tooltip="item.title"
|
||||
class="min-h-control data-[active=true]:border-brand border-l-2 border-transparent px-3 data-[active=true]:font-semibold group-data-[collapsible=icon]:min-h-8"
|
||||
>
|
||||
<Link :href="item.href">
|
||||
<component :is="item.icon" />
|
||||
<Link
|
||||
:href="item.href"
|
||||
:aria-current="
|
||||
(item.isActive ??
|
||||
isCurrentUrl(
|
||||
item.href,
|
||||
undefined,
|
||||
item.match === 'section',
|
||||
))
|
||||
? 'page'
|
||||
: undefined
|
||||
"
|
||||
>
|
||||
<component :is="item.icon" aria-hidden="true" />
|
||||
<span>{{ item.title }}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
|
||||
Reference in New Issue
Block a user