1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/components/landing/FeaturedArticles.tsx
Mike Surowiec ae3d8916c6 Cleanup featuredLinks usage, fix insights page, better ArticleList (#19872)
* cleanup featuredLinks usage, fix insights page, better ArticleList component
2021-06-15 18:22:43 +00:00

49 lines
1.5 KiB
TypeScript

import cx from 'classnames'
import { useProductLandingContext } from 'components/context/ProductLandingContext'
import { useTranslation } from 'components/hooks/useTranslation'
import { ArticleList } from './ArticleList'
export const FeaturedArticles = () => {
const { featuredArticles = [], whatsNewChangelog, changelogUrl } = useProductLandingContext()
const hasWhatsNewChangelog = whatsNewChangelog && whatsNewChangelog.length > 0
const { t } = useTranslation('toc')
return (
<div className="d-lg-flex gutter my-6 py-6">
{featuredArticles.map((section, i) => {
return (
<div
key={section.label + i}
className={cx('col-12 mb-4 mb-lg-0', hasWhatsNewChangelog ? 'col-lg-4' : 'col-lg-6')}
>
<ArticleList
title={section.label}
titleVariant="large"
viewAllHref={section.viewAllHref}
articles={section.articles}
/>
</div>
)
})}
{hasWhatsNewChangelog && (
<div className={cx('col-12 mb-4 mb-lg-0 col-lg-4')}>
<ArticleList
title={t('whats_new')}
titleVariant="large"
viewAllHref={changelogUrl}
articles={(whatsNewChangelog || []).map((link) => {
return {
title: link.title,
date: link.date,
href: link.href,
}
})}
/>
</div>
)}
</div>
)
}