import React from 'react'; import clsx from 'clsx'; import { CardStat, CardStatProps } from '../../components/CardStat'; import { PageGrid } from '../../components/PageGrid/page-grid'; /** * Configuration for a single stat card in the CardStats pattern */ export type CardStatsCardConfig = CardStatProps; /** * Props for the CardStats pattern component */ export interface CardStatsProps extends React.ComponentPropsWithoutRef<'section'> { /** Section heading text */ heading: React.ReactNode; /** Optional section description text */ description?: React.ReactNode; /** Array of CardStat configurations */ cards: CardStatsCardConfig[]; } /** * CardStats Pattern Component * * A section pattern that displays a heading, optional description, and a responsive * grid of CardStat components. Designed for showcasing key statistics and metrics. * * Features: * - Responsive grid layout (2 columns mobile/tablet, 3 columns desktop) * - Heading with `heading-md` typography (Tobias Light) * - Optional description with `body-l` typography (Booton Light) * - Proper spacing using PageGrid for container and alignment * - Full dark mode support * * @example * ```tsx * * ``` */ export const CardStats = React.forwardRef( (props, ref) => { const { heading, description, cards, className, ...rest } = props; // Early return for empty cards array if (cards.length === 0) { console.warn('CardStats: No cards provided'); return null; } return ( } className={clsx('bds-card-stats', className)} {...rest} > {/* Header section */}

{heading}

{description && (

{description}

)}
{cards.map((cardConfig, index) => ( ))}
); } ); CardStats.displayName = 'CardStats'; export default CardStats;