MCPcopy Create free account
hub / github.com/github/docs / CommunityExamples

Function CommunityExamples

components/landing/CommunityExamples.tsx:8–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { RepoCard } from 'components/landing/RepoCard'
7
8export 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}

Callers

nothing calls this directly

Calls 2

useProductLandingContextFunction · 0.90
useTranslationFunction · 0.90

Tested by

no test coverage detected