From 51dc0a27b535343e32535fe9e0913b7e340b5cb7 Mon Sep 17 00:00:00 2001 From: Kevin Stadler Date: Wed, 9 Oct 2024 09:33:33 +0200 Subject: [PATCH] fix: close both works+prose menus when navigating away from works --- components/app-header-nav-menu.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/components/app-header-nav-menu.tsx b/components/app-header-nav-menu.tsx index 6cfebc5..c5825d9 100644 --- a/components/app-header-nav-menu.tsx +++ b/components/app-header-nav-menu.tsx @@ -44,14 +44,17 @@ export function AppHeaderNavMenu(): ReactNode { }), ); + const closeMenus = () => { + setWorksMenuOpen(false); + setProseMenuOpen(false); + }; + const topLevelItems = { home: ( { - setWorksMenuOpen(false); - }} + onClick={closeMenus} /> ), works: ( @@ -66,27 +69,21 @@ export function AppHeaderNavMenu(): ReactNode { { - setWorksMenuOpen(false); - }} + onClick={closeMenus} /> ), translators: ( { - setWorksMenuOpen(false); - }} + onClick={closeMenus} /> ), search: ( { - setWorksMenuOpen(false); - }} + onClick={closeMenus} /> ), };