Skip to content

Commit 949a883

Browse files
committed
hide white secondary menus when empty
1 parent ad276ce commit 949a883

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/components/TopNav/index.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -455,17 +455,19 @@ const TopNav = ({
455455
chosenArrowX={chosenArrowX}
456456
/>
457457

458-
{/* Level 3 menu */}
459-
<SubNav
460-
open={forceHideLevel3 ? false : showLevel3}
461-
menu={activeMenu2 || activeMenu1}
462-
isSecondaryMenu={!activeMenu2}
463-
activeChildId={activeLevel3Id}
464-
showIndicator={showIconSelect}
465-
indicatorX={iconSelectX}
466-
createHandleClickItem={createHandleClickLevel3}
467-
createSetRef={createSetRef}
468-
/>
458+
{/* Level 3 menu (hide if secondaryMenu is empty) */}
459+
{ !!(activeMenu2 || (activeMenu1 && activeMenu1.secondaryMenu && activeMenu1.secondaryMenu.length)) && (
460+
<SubNav
461+
open={forceHideLevel3 ? false : showLevel3}
462+
menu={activeMenu2 || activeMenu1}
463+
isSecondaryMenu={!activeMenu2}
464+
activeChildId={activeLevel3Id}
465+
showIndicator={showIconSelect}
466+
indicatorX={iconSelectX}
467+
createHandleClickItem={createHandleClickLevel3}
468+
createSetRef={createSetRef}
469+
/>
470+
)}
469471

470472
{/* Mobile level 2 menu */}
471473
{showLeftMenu && activeMenu1 && (

0 commit comments

Comments
 (0)