Skip to content

Commit

Permalink
Support startsWith Nav Extension property
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewballantyne committed Jun 7, 2022
1 parent 407bc56 commit 2700e4e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions frontend/public/components/nav/NavLinkRoot.tsx
Expand Up @@ -26,13 +26,15 @@ const navLinkRootMapStateToProps = (
state: RootState,
{ component: Component, ...props }: NavLinkRootProps,
): NavLinkRootStateProps => {
const { startsWith } = props;

const activeNamespace = getActiveNamespace(state);
const location = stripNS(state.UI.get('location'));
return {
activeNamespace: getActiveNamespace(state),
isActive: Component.isActive(
props,
stripNS(state.UI.get('location')),
getActiveNamespace(state),
),
activeNamespace,
isActive:
startsWith?.some((path) => location.startsWith(path)) ||
Component.isActive(props, location, activeNamespace),
};
};

Expand Down

0 comments on commit 2700e4e

Please sign in to comment.