From 1e9d5c2742175a75c62f9daa8245234006648b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Tue, 7 Jan 2025 14:51:14 +0100 Subject: [PATCH] feat: add setOpen functionality to SidebarItem for improved menu interaction --- src/app/components/Sidebar/index.tsx | 1 + src/app/components/Sidebar/item.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/components/Sidebar/index.tsx b/src/app/components/Sidebar/index.tsx index 40a8510..87ee3c1 100644 --- a/src/app/components/Sidebar/index.tsx +++ b/src/app/components/Sidebar/index.tsx @@ -141,6 +141,7 @@ export const Sidebar = ({ href={item.href} title={item.title} icon={item.icon} + setOpen={setOpen} /> ))} diff --git a/src/app/components/Sidebar/item.tsx b/src/app/components/Sidebar/item.tsx index 295a396..2856c8c 100644 --- a/src/app/components/Sidebar/item.tsx +++ b/src/app/components/Sidebar/item.tsx @@ -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 ( router.push(href)} + onPress={() => { + router.push(href); + setOpen(false); + }} color="foreground" className="w-full p-2 gap-3 text-md" >