| 37 | ) |
| 38 | |
| 39 | const productSection = () => ( |
| 40 | <li className="mt-2 mb-3" data-testid="product-sidebar-items"> |
| 41 | <ul className="list-style-none"> |
| 42 | {currentProductTree && |
| 43 | currentProductTree.childPages.map((childPage, i) => { |
| 44 | const isStandaloneCategory = childPage.documentType === 'article' |
| 45 | |
| 46 | const childTitle = childPage.shortTitle || childPage.title |
| 47 | const isActive = |
| 48 | routePath.includes(childPage.href + '/') || routePath === childPage.href |
| 49 | const defaultOpen = hasExactCategory ? isActive : false |
| 50 | return ( |
| 51 | <li |
| 52 | key={childPage.href + i} |
| 53 | data-is-active-category={isActive} |
| 54 | data-is-current-page={isActive && isStandaloneCategory} |
| 55 | className={cx('py-1', isActive && 'color-bg-inset')} |
| 56 | > |
| 57 | {isStandaloneCategory ? ( |
| 58 | <Link |
| 59 | href={childPage.href} |
| 60 | className="pl-4 pr-2 py-2 d-block flex-auto mr-3 color-fg-default no-underline text-bold" |
| 61 | > |
| 62 | {childTitle} |
| 63 | </Link> |
| 64 | ) : ( |
| 65 | <ProductCollapsibleSection |
| 66 | defaultOpen={defaultOpen} |
| 67 | routePath={routePath} |
| 68 | title={childTitle} |
| 69 | page={childPage} |
| 70 | /> |
| 71 | )} |
| 72 | </li> |
| 73 | ) |
| 74 | })} |
| 75 | </ul> |
| 76 | </li> |
| 77 | ) |
| 78 | |
| 79 | const restSection = () => { |
| 80 | const conceptualPages = currentProductTree.childPages.filter( |