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} href={item.href}
title={item.title} title={item.title}
icon={item.icon} icon={item.icon}
setOpen={setOpen}
/> />
</li> </li>
))} ))}

View File

@ -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"
> >