feat: enhance mobile experience by closing sidebar on link click
This commit is contained in:
parent
7371a9e517
commit
00ff74bab6
@ -111,6 +111,7 @@ const sistemItems: NavMenuItem[] = [
|
||||
function MenuGroup({ label, items }: { label: string; items: NavMenuItem[] }) {
|
||||
const { isCurrentUrl } = useCurrentUrl();
|
||||
const { can, canAny } = useCan();
|
||||
const { isMobile, setOpenMobile } = useSidebar();
|
||||
|
||||
const filtered = items.filter((item) => {
|
||||
if (!item.permission) {
|
||||
@ -139,7 +140,7 @@ function MenuGroup({ label, items }: { label: string; items: NavMenuItem[] }) {
|
||||
isActive={isCurrentUrl(item.href)}
|
||||
tooltip={{ children: item.title }}
|
||||
>
|
||||
<Link href={item.href} prefetch>
|
||||
<Link href={item.href} prefetch onClick={() => isMobile && setOpenMobile(false)}>
|
||||
<item.icon />
|
||||
<span>{item.title}</span>
|
||||
</Link>
|
||||
@ -174,7 +175,7 @@ export function AppSidebar() {
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton size="lg" asChild>
|
||||
<Link href={dashboard.url()} prefetch>
|
||||
<Link href={dashboard.url()} prefetch onClick={() => isMobile && setOpenMobile(false)}>
|
||||
<AppLogo />
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
@ -191,7 +192,7 @@ export function AppSidebar() {
|
||||
isActive={isCurrentUrl(dasborItem.href)}
|
||||
tooltip={{ children: dasborItem.title }}
|
||||
>
|
||||
<Link href={dasborItem.href} prefetch>
|
||||
<Link href={dasborItem.href} prefetch onClick={() => isMobile && setOpenMobile(false)}>
|
||||
<dasborItem.icon />
|
||||
<span>{dasborItem.title}</span>
|
||||
</Link>
|
||||
@ -209,7 +210,7 @@ export function AppSidebar() {
|
||||
isActive={isCurrentUrl(analisaItem.href)}
|
||||
tooltip={{ children: analisaItem.title }}
|
||||
>
|
||||
<Link href={analisaItem.href} prefetch>
|
||||
<Link href={analisaItem.href} prefetch onClick={() => isMobile && setOpenMobile(false)}>
|
||||
<analisaItem.icon />
|
||||
<span>{analisaItem.title}</span>
|
||||
</Link>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user