Skip to content

Commit 1b27eb9

Browse files
feat: updated to the latest version
1 parent 6180625 commit 1b27eb9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

apps/frontend/src/components/Header/MobileNavigation/MobileNavigation.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Menu, X } from 'lucide-react';
44
import { useLocale } from 'next-intl';
5-
import { useState } from 'react';
5+
import React, { useEffect, useState } from 'react';
66

77
import { Models } from '@o2s/framework/modules';
88

@@ -15,7 +15,7 @@ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@o2s
1515
import { Typography } from '@o2s/ui/components/typography';
1616
import { cn } from '@o2s/ui/lib/utils';
1717

18-
import { Link as NextLink } from '@/i18n';
18+
import { Link as NextLink, usePathname } from '@/i18n';
1919

2020
import { MobileNavigationProps } from './MobileNavigation.types';
2121

@@ -29,10 +29,15 @@ export function MobileNavigation({
2929
title,
3030
mobileMenuLabel,
3131
}: MobileNavigationProps) {
32+
const pathname = usePathname();
3233
const locale = useLocale();
3334

3435
const [isMenuOpen, setIsMenuOpen] = useState(false);
3536

37+
useEffect(() => {
38+
setIsMenuOpen(false);
39+
}, [pathname]);
40+
3641
const navigationItemClass = cn(
3742
navigationMenuTriggerStyle(),
3843
'no-underline hover:no-underline w-full !justify-between h-10 p-2 !text-base !text-[hsl(var(--navbar-primary))] hover:!text-[hsl(var(--accent-foreground))] focus-visible:outline-[hsl(var(--ring))]',

0 commit comments

Comments
 (0)