Skip to content

Commit

Permalink
fix: closeMenu working when subsiteMenu diff from main
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagner3UB committed Apr 8, 2024
1 parent 7d74181 commit 2ef66de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const isChildActive = (itemUrl, pathname) => {
return pathname.indexOf(itemUrl) > -1;
};

const MegaMenu = ({ item, pathname }) => {
const MegaMenu = ({ item, pathname, closeMenu }) => {
const intl = useIntl();
const blocksFieldname = getBlocksFieldname(item);
const blocksLayoutFieldname = getBlocksLayoutFieldname(item);
Expand Down Expand Up @@ -317,7 +317,10 @@ const MegaMenu = ({ item, pathname }) => {
title={child.title}
condition={!!child['@id']}
key={child['@id']}
onClick={() => setMenuStatus(false)}
onClick={() => {
setMenuStatus(false);
closeMenu();
}}
className={cx('list-item', {
active: isChildActive(
flattenToAppURL(child['@id']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ const Navigation = ({ pathname }) => {
item={item}
pathname={pathname}
key={index + 'mm'}
closeMenu={() => {
setCollapseOpen(false);
}}
/>
))}
</Nav>
Expand Down

0 comments on commit 2ef66de

Please sign in to comment.