Skip to content

Commit

Permalink
docs(nxdev): menu is open when sub-item is current (#9507)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcabanes committed Mar 24, 2022
1 parent 80dd63e commit 1dd4044
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions nx-dev/ui-common/src/lib/sidebar.tsx
Expand Up @@ -105,14 +105,17 @@ function SidebarSectionItems({
)}
</h5>
<ul className={cx('mb-6', collapsed ? 'hidden' : '')}>
{(item.itemList as MenuItem[]).map((item, index) => {
const isActiveLink = item.path === withoutAnchors(router?.asPath);
{(item.itemList as MenuItem[]).map((subItem, index) => {
const isActiveLink = subItem.path === withoutAnchors(router?.asPath);
if (isActiveLink && collapsed) {
handleCollapseToggle();
}
return (
<li
key={item.id + '-' + index}
data-testid={`section-li:${item.id}`}
key={subItem.id + '-' + index}
data-testid={`section-li:${subItem.id}`}
>
<Link href={item.path as string}>
<Link href={subItem.path as string}>
<a
className={cx(
'relative block py-1 text-gray-500 transition-colors duration-200 hover:text-gray-900'
Expand All @@ -126,7 +129,7 @@ function SidebarSectionItems({
'text-gray-900': isActiveLink,
})}
>
{item.name}
{subItem.name}
</span>
</a>
</Link>
Expand Down

1 comment on commit 1dd4044

@vercel
Copy link

@vercel vercel bot commented on 1dd4044 Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.