From bcd83b29c577bda5fbec702cdef785382cd1a5f9 Mon Sep 17 00:00:00 2001 From: Lee Chase <lee.chase@uk.ibm.com> Date: Wed, 24 Jul 2019 11:39:58 +0100 Subject: [PATCH] feat: update nav for tutorial tabs --- src/components/LeftNav/LeftNavItem.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/LeftNav/LeftNavItem.js b/src/components/LeftNav/LeftNavItem.js index b80688ce97..588db8e850 100644 --- a/src/components/LeftNav/LeftNavItem.js +++ b/src/components/LeftNav/LeftNavItem.js @@ -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, };