feat: add setOpen functionality to SidebarItem for improved menu interaction

This commit is contained in:
Rémi 2025-01-07 14:51:14 +01:00
parent 2f304684f3
commit 1e9d5c2742
2 changed files with 7 additions and 1 deletions

View File

@ -141,6 +141,7 @@ export const Sidebar = ({
href={item.href}
title={item.title}
icon={item.icon}
setOpen={setOpen}
/>
</li>
))}

View File

@ -6,16 +6,21 @@ export const SidebarItem = ({
title,
icon,
href,
setOpen,
}: {
title: string;
icon: React.ReactNode;
href: string;
setOpen: (open: boolean) => void;
}) => {
const router = useRouter();
return (
<Link
onPress={() => router.push(href)}
onPress={() => {
router.push(href);
setOpen(false);
}}
color="foreground"
className="w-full p-2 gap-3 text-md"
>