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

Function ComponentList

packages/dev/s2-docs/src/ComponentCard.tsx:642–684  ·  view source on GitHub ↗
(props: ComponentListProps)

Source from the content-addressed store, hash-verified

640}
641
642export function ComponentList(props: ComponentListProps) {
643 let pages = props.pages.filter(page => props.components.includes(page.name));
644 return (
645 <ul
646 className={style({
647 display: 'flex',
648 gap: 24,
649 listStyleType: 'none',
650 overflow: 'auto',
651 '--paddingX': {
652 type: 'paddingStart',
653 value: {
654 default: 12,
655 lg: 40
656 }
657 },
658 paddingX: '--paddingX',
659 marginX: {
660 default: -12,
661 lg: -40
662 },
663 paddingY: 20,
664 marginY: -20,
665 scrollSnapType: 'x',
666 scrollPaddingX: '--paddingX'
667 })}
668 style={{
669 maskImage:
670 'linear-gradient(to right, transparent, white var(--paddingX) calc(100% - var(--paddingX)), transparent)'
671 }}>
672 {pages.map(page => (
673 <li key={page.url}>
674 <ComponentCard
675 name={getTitle(page)}
676 href={page.url}
677 size="S"
678 UNSAFE_style={{scrollSnapAlign: 'start'}}
679 />
680 </li>
681 ))}
682 </ul>
683 );
684}
685
686const getTitle = (page: Page) => page.tableOfContents?.[0]?.title ?? '';

Callers

nothing calls this directly

Calls 2

getTitleFunction · 0.70
filterMethod · 0.65

Tested by

no test coverage detected