// ** Next Import
import Link from 'next/link'
// ** MUI Imports
import Box from '@mui/material/Box'
import Grid from '@mui/material/Grid'
import Typography from '@mui/material/Typography'
// ** Icon Imports
import Icon from 'src/@core/components/icon'
// ** Custom Components Import
import CustomAvatar from 'src/@core/components/mui/avatar'
// ** Types
import { HelpCenterCategoriesType } from 'src/@fake-db/types'
const HelpCenterLandingKnowledgeBase = ({ categories }: { categories: HelpCenterCategoriesType[] }) => {
const renderCategories = () => {
if (categories && categories.length) {
return categories.map(category => {
const totalArticles = category.subCategories
.map(subCategory => subCategory.articles.length)
.reduce((partialSum, a) => partialSum + a, 0)
return (
{category.title}
{category.subCategories.map(subcategory => (
{subcategory.title}
))}
{`${totalArticles} Articles`}
)
})
} else {
return null
}
}
return (
{renderCategories()}
)
}
export default HelpCenterLandingKnowledgeBase