From 930d80aeb5a463126d9f2ba1b0fcc70a06a71ec9 Mon Sep 17 00:00:00 2001 From: Alexandra Goff Date: Fri, 20 Dec 2024 12:53:32 -0500 Subject: [PATCH] fix: keep pinned when mobile submenu open --- .../organisms/Header/navigation/Vertical/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/organisms/Header/navigation/Vertical/index.tsx b/components/organisms/Header/navigation/Vertical/index.tsx index f0a27f9b..57c8d8e5 100644 --- a/components/organisms/Header/navigation/Vertical/index.tsx +++ b/components/organisms/Header/navigation/Vertical/index.tsx @@ -23,7 +23,7 @@ const NavigationVertical: FunctionComponent = ({ }) => { const [open, setOpen] = useState(false); const [active, setActive] = useState(null); - const { setPinned } = useHeadroom(); + const { pinned, setPinned } = useHeadroom(); const handleOpenToggle = () => { if (open) { @@ -36,7 +36,12 @@ const NavigationVertical: FunctionComponent = ({ }; function handleToggleClick(id: string) { - setActive((prevActive) => (prevActive === id ? null : id)); + if (active === id) { + setActive(null); + } else { + setPinned(true); + setActive(id); + } } return (