Skip to content

Commit 1567be4

Browse files
committed
fix: keep pinned when mobile submenu open
1 parent 23b7fd5 commit 1567be4

File tree

1 file changed

+7
-2
lines changed
  • components/organisms/Header/navigation/Vertical

1 file changed

+7
-2
lines changed

components/organisms/Header/navigation/Vertical/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const NavigationVertical: FunctionComponent<NavigationProps> = ({
2323
}) => {
2424
const [open, setOpen] = useState(false);
2525
const [active, setActive] = useState<string | null>(null);
26-
const { setPinned } = useHeadroom();
26+
const { pinned, setPinned } = useHeadroom();
2727

2828
const handleOpenToggle = () => {
2929
if (open) {
@@ -36,7 +36,12 @@ const NavigationVertical: FunctionComponent<NavigationProps> = ({
3636
};
3737

3838
function handleToggleClick(id: string) {
39-
setActive((prevActive) => (prevActive === id ? null : id));
39+
if (active === id) {
40+
setActive(null);
41+
} else {
42+
setPinned(true);
43+
setActive(id);
44+
}
4045
}
4146

4247
return (

0 commit comments

Comments
 (0)