({ treeNode }: { treeNode: ProductTreeNode })
| 30 | } |
| 31 | |
| 32 | const ProductTreeNodeList = ({ treeNode }: { treeNode: ProductTreeNode }) => { |
| 33 | const [isShowingMore, setIsShowingMore] = useState(false) |
| 34 | |
| 35 | return ( |
| 36 | <div className="col-12 col-lg-4 mb-6 height-full"> |
| 37 | <h3 className="mb-3 f4"> |
| 38 | <Link className="color-unset text-underline" href={treeNode.href}> |
| 39 | {treeNode.title} |
| 40 | </Link> |
| 41 | </h3> |
| 42 | |
| 43 | <ActionList variant="full"> |
| 44 | {treeNode.childPages.map((childNode, index) => { |
| 45 | return ( |
| 46 | <ActionList.Item |
| 47 | as="li" |
| 48 | key={childNode.href + index} |
| 49 | className={cx( |
| 50 | 'width-full pl-0', |
| 51 | !isShowingMore && index >= maxArticles ? 'd-none' : null |
| 52 | )} |
| 53 | sx={{ |
| 54 | borderRadius: 0, |
| 55 | ':hover': { |
| 56 | borderRadius: 0, |
| 57 | }, |
| 58 | }} |
| 59 | > |
| 60 | <Link className="d-block width-full" href={childNode.href}> |
| 61 | {childNode.title} |
| 62 | {childNode.documentType === 'mapTopic' ? ( |
| 63 | <small className="color-fg-muted d-inline-block"> |
| 64 | • {childNode.childPages.length} articles |
| 65 | </small> |
| 66 | ) : null} |
| 67 | </Link> |
| 68 | </ActionList.Item> |
| 69 | ) |
| 70 | })} |
| 71 | </ActionList> |
| 72 | {!isShowingMore && treeNode.childPages.length > maxArticles && ( |
| 73 | <button onClick={() => setIsShowingMore(true)} className="mt-2 btn-link Link--secondary"> |
| 74 | Show {treeNode.childPages.length - maxArticles} more{' '} |
| 75 | <ChevronDownIcon className="v-align-text-bottom" /> |
| 76 | </button> |
| 77 | )} |
| 78 | </div> |
| 79 | ) |
| 80 | } |
nothing calls this directly
no outgoing calls
no test coverage detected