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

Function ComponentCard

packages/dev/s2-docs/src/ComponentCard.tsx:543–586  ·  view source on GitHub ↗
({
  id,
  name,
  href,
  description,
  size,
  ...otherProps
}: ComponentCardProps)

Source from the content-addressed store, hash-verified

541}
542
543export function ComponentCard({
544 id,
545 name,
546 href,
547 description,
548 size,
549 ...otherProps
550}: ComponentCardProps) {
551 let preview;
552 let releaseVersion = getReleaseVersionLabel(href);
553
554 if (releaseVersion) {
555 preview = (
556 <div className={illustrationContainer}>
557 {/* Background gradient */}
558 <Image
559 alt=""
560 styles={backgroundStyles}
561 src={[
562 {srcSet: BackgroundLight, colorScheme: 'light'},
563 {srcSet: BackgroundDark, colorScheme: 'dark'}
564 ]}
565 />
566 <span className={releaseText}>{releaseVersion}</span>
567 </div>
568 );
569 } else if (href.includes('examples/') && !href.endsWith('/')) {
570 preview = <ExampleImage name={href} />;
571 } else {
572 preview = <ComponentIllustration name={name} href={href} />;
573 }
574
575 return (
576 <ComponentCardClient
577 {...otherProps}
578 id={id}
579 href={href}
580 size={size}
581 name={name}
582 description={description}
583 preview={preview}
584 />
585 );
586}
587
588interface ComponentListProps {
589 pages: Page[];

Callers

nothing calls this directly

Calls 1

getReleaseVersionLabelFunction · 0.85

Tested by

no test coverage detected