import cx from 'classnames'
import { useState } from 'react'
import { ChevronDownIcon } from '@primer/octicons-react'
import { ActionList } from '@primer/components'
import { ProductTreeNode, useMainContext } from 'components/context/MainContext'
import { Link } from 'components/Link'
const maxArticles = 5
export const ProductArticlesList = () => {
const { currentProductTree } = useMainContext()
if (!currentProductTree) {
return null
}
return (
{currentProductTree.childPages.map((treeNode, i) => {
if (treeNode.page.documentType === 'article') {
return null
}
return
})}
)
}
const ProductTreeNodeList = ({ treeNode }: { treeNode: ProductTreeNode }) => {
const [isShowingMore, setIsShowingMore] = useState(false)
return (
{treeNode.renderedFullTitle}
{
return {
renderItem: () => (
= maxArticles ? 'd-none' : null)}
sx={{
borderRadius: 0,
':hover': {
borderRadius: 0,
},
}}
>
{childNode.page.title}
{childNode.page.documentType === 'mapTopic' ? (
• {childNode.childPages.length} articles
) : null}
),
}
})}
>
{!isShowingMore && treeNode.childPages.length > maxArticles && (
)}
)
}