Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
feat: update nav for tutorial tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-chase committed Jul 24, 2019
1 parent 4b21e96 commit bcd83b2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/LeftNav/LeftNavItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,20 @@ export default class LeftNavItem extends React.Component {
// children with similar names but disimilar parents.
const isNavItemActive = locationContainsPath(location, [itemSlug, item]);

let framework = '';
if (itemSlug === 'tutorial') {
const checkFramework = location.href.match(
/\/tutorial\/[a-zA-Z0-9-_]+\/([a-zA-Z0-9-_]*)/
);
if (checkFramework && checkFramework[1]) {
framework = `/${checkFramework[1]}`;
}
}

const navItemProps = {
href: 'javascript:void(0)',
element: Link,
to: `/${this.props.itemSlug}/${item}`,
to: `/${this.props.itemSlug}/${item}${framework}`,
key: item,
};

Expand Down

0 comments on commit bcd83b2

Please sign in to comment.