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