feat: update Sidebar component to handle mobile state; modify SidebarItem to close on mobile navigation

This commit is contained in:
Rémi 2025-01-07 19:11:32 +01:00
parent a23b58e05c
commit 4606be56a0
3 changed files with 6 additions and 3 deletions

View File

@ -10,4 +10,4 @@ OAUTH_AUTHORIZATION_URL=
OAUTH_TOKEN_URL=
OAUTH_USERINFO_URL=
OAUTH_JWKS_ENDPOINT=
OAUTH_SCOPES="openid email profile offline_access"
OAUTH_SCOPES="openid email profile"

View File

@ -107,6 +107,7 @@ export const Sidebar = ({
icon={item.icon}
setOpen={setSidebarIsOpen}
showTitle={sidebarIsOpen}
isMobile={isMobile}
/>
</li>
))}

View File

@ -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 = ({
<Link
onPress={() => {
router.push(href);
setOpen(false);
if (isMobile) setOpen(false);
}}
color="foreground"
className="w-full p-2 gap-3 text-md"
>
<span className="text-xl">{icon}</span>
{showTitle && <span className="text-sm">{title}</span>}
{showTitle && <span className="text-sm">{title}</span>}
</Link>
);
};