Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jenbreese committed Aug 22, 2024
1 parent 9df9fe7 commit aa41d83
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const MenuLevel0 = ({...props}) => {
return (

<MenuItemContainer open={submenuOpen} level={level}>
{!isNoLink &&
<MenuLink
href={url}
aria-current={isCurrent ? "page" : undefined}
level={level}
isCurrent={isCurrent}
inTrail={inTrail}
>
{title}
</MenuLink>
}
{isNoLink &&
<NoLink open={submenuOpen}>{title}</NoLink>
}

{items && level === 0 ? (
<Button
ref={buttonRef}
onClick={() => setSubmenuOpen(!submenuOpen)}
aria-expanded={submenuOpen}
aria-label={(submenuOpen ? "Close" : "Open") + ` ${title} Submenu`}
>
<Caret style={{
transform: submenuOpen ? "rotate(180deg)" : "",
transition: "transform 0.2s ease-in-out",
width: "16px",
}}
/>
</Button>
) : ""
}
</MenuItemContainer>

{items &&

<MenuListWrapper>
<MenuList open={submenuOpen} level={level}>

{items.map(item =>
<MenuItem key={item.id} {...item} level={level + 1}/>
)}

</MenuList>
</MenuListWrapper>
}

)
}
export default MenuLevel0;
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,7 @@ const MenuItem = ({title, url, items, level = 0}: { title: string, url: string,
<NoLink open={submenuOpen}>{title}</NoLink>
}

{items && level ===0 ? (
<>
{items && level === 0 ? (
<Button
ref={buttonRef}
onClick={() => setSubmenuOpen(!submenuOpen)}
Expand All @@ -481,7 +480,6 @@ const MenuItem = ({title, url, items, level = 0}: { title: string, url: string,
}}
/>
</Button>
</>
) : ""
}
</MenuItemContainer>
Expand All @@ -498,6 +496,7 @@ const MenuItem = ({title, url, items, level = 0}: { title: string, url: string,
</MenuList>
</MenuListWrapper>
}

</OutsideClickHandler>

)
Expand Down

0 comments on commit aa41d83

Please sign in to comment.