MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ExampleList

Function ExampleList

packages/dev/s2-docs/src/ExampleList.tsx:33–94  ·  view source on GitHub ↗
({tag, pages})

Source from the content-addressed store, hash-verified

31};
32
33export function ExampleList({tag, pages}) {
34 let examples = pages
35 .filter(
36 page =>
37 page.name.startsWith('react-aria/examples/') &&
38 !page.name.endsWith('index') &&
39 (!tag || page.exports?.keywords.includes(tag))
40 )
41 .sort((a, b) => getTitle(a).localeCompare(getTitle(b)));
42
43 return (
44 <ul
45 itemScope
46 itemType="https://schema.org/ItemList"
47 className={style({
48 display: 'grid',
49 gridTemplateColumns: `repeat(auto-fit, ${size(240)})`,
50 gap: 24,
51 marginTop: 32,
52 padding: 0,
53 listStyleType: 'none',
54 justifyContent: {
55 default: 'center',
56 lg: 'start'
57 }
58 })}>
59 <meta itemProp="name" content="Examples" />
60 <ImageCoordinator>
61 {examples.map(example => (
62 <li
63 key={example.url}
64 itemProp="itemListElement"
65 itemScope
66 itemType="https://schema.org/ListItem">
67 <div
68 className={style({display: 'contents'})}
69 itemProp="item"
70 itemScope
71 itemType="https://schema.org/TechArticle">
72 <meta itemProp="url" content={example.url} />
73 <Card href={example.url}>
74 <CardPreview>
75 <ExampleImage name={example.name} itemProp="image" />
76 </CardPreview>
77 <Content>
78 <Text slot="title" itemProp="headline">
79 {getTitle(example)}
80 </Text>
81 {example.exports?.description ? (
82 <Text slot="description" itemProp="description">
83 {example.exports?.description}
84 </Text>
85 ) : null}
86 </Content>
87 </Card>
88 </div>
89 </li>
90 ))}

Callers

nothing calls this directly

Calls 4

sizeFunction · 0.90
getTitleFunction · 0.70
sortMethod · 0.65
filterMethod · 0.65

Tested by

no test coverage detected