()
| 6 | import { RepoCard } from 'components/landing/RepoCard' |
| 7 | |
| 8 | export const CommunityExamples = () => { |
| 9 | const { productCommunityExamples } = useProductLandingContext() |
| 10 | const { t } = useTranslation('product_landing') |
| 11 | const [numVisible, setNumVisible] = useState(6) |
| 12 | |
| 13 | if (!productCommunityExamples) { |
| 14 | return null |
| 15 | } |
| 16 | |
| 17 | return ( |
| 18 | <div> |
| 19 | <div className="d-flex flex-wrap gutter"> |
| 20 | {productCommunityExamples.slice(0, numVisible).map((repo) => { |
| 21 | return ( |
| 22 | <div key={repo.repo} className="col-12 col-xl-4 col-lg-6 mb-4"> |
| 23 | <RepoCard repo={repo} /> |
| 24 | </div> |
| 25 | ) |
| 26 | })} |
| 27 | </div> |
| 28 | {numVisible < productCommunityExamples.length && ( |
| 29 | <button |
| 30 | className="btn btn-outline float-right" |
| 31 | onClick={() => setNumVisible(productCommunityExamples.length)} |
| 32 | > |
| 33 | {t('show_more')} <ArrowRightIcon /> |
| 34 | </button> |
| 35 | )} |
| 36 | </div> |
| 37 | ) |
| 38 | } |
nothing calls this directly
no test coverage detected