Skip to content

Commit

Permalink
fix: keep pinned when mobile submenu open
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed Dec 20, 2024
1 parent 7b66824 commit 930d80a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/organisms/Header/navigation/Vertical/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const NavigationVertical: FunctionComponent<NavigationProps> = ({
}) => {
const [open, setOpen] = useState(false);
const [active, setActive] = useState<string | null>(null);
const { setPinned } = useHeadroom();
const { pinned, setPinned } = useHeadroom();

const handleOpenToggle = () => {
if (open) {
Expand All @@ -36,7 +36,12 @@ const NavigationVertical: FunctionComponent<NavigationProps> = ({
};

function handleToggleClick(id: string) {
setActive((prevActive) => (prevActive === id ? null : id));
if (active === id) {
setActive(null);
} else {
setPinned(true);
setActive(id);
}
}

return (
Expand Down

0 comments on commit 930d80a

Please sign in to comment.