1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 16:05:33 -04:00

fix style nesting

This commit is contained in:
2022-05-24 20:48:26 -04:00
parent e614518987
commit ff96ccae44
10 changed files with 192 additions and 188 deletions

View File

@@ -45,12 +45,16 @@ const Menu = ({ ...rest }: MenuProps) => {
return (
<Wrapper {...rest}>
{menuItems.map((item, index) => (
<Item key={index}>
{/* kinda weird/hacky way to determine if the *first part* of the current path matches this href */}
<MenuItem {...item} current={item.href === `/${router.pathname.split("/")[1]}`} />
</Item>
))}
{menuItems.map((item, index) => {
// kinda weird/hacky way to determine if the *first part* of the current path matches this href
const isCurrent = item.href === `/${router.pathname.split("/")[1]}`;
return (
<Item key={index}>
<MenuItem {...item} current={isCurrent} />
</Item>
);
})}
<Item>
<MenuItem icon={ThemeToggle} />