feat: add setOpen functionality to SidebarItem for improved menu interaction
This commit is contained in:
parent
2f304684f3
commit
1e9d5c2742
@ -141,6 +141,7 @@ export const Sidebar = ({
|
|||||||
href={item.href}
|
href={item.href}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
icon={item.icon}
|
icon={item.icon}
|
||||||
|
setOpen={setOpen}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
@ -6,16 +6,21 @@ export const SidebarItem = ({
|
|||||||
title,
|
title,
|
||||||
icon,
|
icon,
|
||||||
href,
|
href,
|
||||||
|
setOpen,
|
||||||
}: {
|
}: {
|
||||||
title: string;
|
title: string;
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
href: string;
|
href: string;
|
||||||
|
setOpen: (open: boolean) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
onPress={() => router.push(href)}
|
onPress={() => {
|
||||||
|
router.push(href);
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
color="foreground"
|
color="foreground"
|
||||||
className="w-full p-2 gap-3 text-md"
|
className="w-full p-2 gap-3 text-md"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user