From 4606be56a04e11e4b332adcc9ab14210242d14c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Tue, 7 Jan 2025 19:11:32 +0100 Subject: [PATCH] feat: update Sidebar component to handle mobile state; modify SidebarItem to close on mobile navigation --- .env.example | 2 +- src/app/components/Sidebar/index.tsx | 1 + src/app/components/Sidebar/item.tsx | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 6e2f324..aad61a0 100644 --- a/.env.example +++ b/.env.example @@ -10,4 +10,4 @@ OAUTH_AUTHORIZATION_URL= OAUTH_TOKEN_URL= OAUTH_USERINFO_URL= OAUTH_JWKS_ENDPOINT= -OAUTH_SCOPES="openid email profile offline_access" \ No newline at end of file +OAUTH_SCOPES="openid email profile" \ No newline at end of file diff --git a/src/app/components/Sidebar/index.tsx b/src/app/components/Sidebar/index.tsx index 36ae100..4ce049c 100644 --- a/src/app/components/Sidebar/index.tsx +++ b/src/app/components/Sidebar/index.tsx @@ -107,6 +107,7 @@ export const Sidebar = ({ icon={item.icon} setOpen={setSidebarIsOpen} showTitle={sidebarIsOpen} + isMobile={isMobile} /> ))} diff --git a/src/app/components/Sidebar/item.tsx b/src/app/components/Sidebar/item.tsx index d88b619..e8ecfcb 100644 --- a/src/app/components/Sidebar/item.tsx +++ b/src/app/components/Sidebar/item.tsx @@ -8,6 +8,7 @@ export type SidebarItemProps = { href: string; setOpen: (open: boolean) => void; showTitle: boolean; + isMobile: boolean; }; export const SidebarItem = ({ @@ -16,6 +17,7 @@ export const SidebarItem = ({ href, setOpen, showTitle = true, + isMobile }: SidebarItemProps) => { const router = useRouter(); @@ -23,13 +25,13 @@ export const SidebarItem = ({ { router.push(href); - setOpen(false); + if (isMobile) setOpen(false); }} color="foreground" className="w-full p-2 gap-3 text-md" > {icon} - {showTitle && {title}} + {showTitle && {title}} ); };