Skip to content

Commit

Permalink
fix: close both works+prose menus when navigating away from works
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstadler committed Oct 9, 2024
1 parent 1f006bd commit 51dc0a2
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions components/app-header-nav-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ export function AppHeaderNavMenu(): ReactNode {
}),
);

const closeMenus = () => {
setWorksMenuOpen(false);
setProseMenuOpen(false);
};

const topLevelItems = {
home: (
<AppHeaderNavMenuLink
href={createHref({ pathname: "/" })}
label={t("links.home")}
onClick={() => {
setWorksMenuOpen(false);
}}
onClick={closeMenus}
/>
),
works: (
Expand All @@ -66,27 +69,21 @@ export function AppHeaderNavMenu(): ReactNode {
<AppHeaderNavMenuLink
href={createHref({ pathname: "/languages" })}
label={t("links.languages")}
onClick={() => {
setWorksMenuOpen(false);
}}
onClick={closeMenus}
/>
),
translators: (
<AppHeaderNavMenuLink
href={createHref({ pathname: "/translators" })}
label={t("links.translators")}
onClick={() => {
setWorksMenuOpen(false);
}}
onClick={closeMenus}
/>
),
search: (
<AppHeaderNavMenuLink
href={createHref({ pathname: "/search" })}
label={t("links.search")}
onClick={() => {
setWorksMenuOpen(false);
}}
onClick={closeMenus}
/>
),
};
Expand Down

0 comments on commit 51dc0a2

Please sign in to comment.