import React from 'react'; import { Button } from '../Button'; interface ButtonConfig { /** Button label text */ label: string; /** Click handler for button */ onClick?: () => void; /** Link href for button */ href?: string; } export interface CardStatProps { /** The main statistic to display (e.g., "6 Million+") */ statistic: string; /** Superscript text for the statistic */ superscript?: '*' | '+' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '0'; /** Descriptive label for the statistic */ label: string; /** Background color variant * - 'lilac': Purple/lavender background * - 'green': XRPL brand green background * - 'light-gray': Light gray background (#CAD4DF) * - 'dark-gray': Dark gray background (#8A919A) */ variant?: 'lilac' | 'green' | 'light-gray' | 'dark-gray'; /** Primary button configuration */ primaryButton?: ButtonConfig; /** Secondary button configuration */ secondaryButton?: ButtonConfig; /** Additional CSS classes */ className?: string; } /** * BDS CardStat Component * * A statistics card component following the XRPL Brand Design System. * Displays a prominent statistic with a descriptive label and optional CTA buttons. * * Color variants: * - lilac: Purple/lavender background * - green: XRPL brand green background * - light-gray: Light gray background * - dark-gray: Dark gray background * * @example * */ export const CardStat: React.FC = ({ statistic, superscript, label, variant = 'lilac', primaryButton, secondaryButton, className = '', }) => { // Build class names using BEM with bds namespace const classNames = [ 'bds-card-stat', `bds-card-stat--${variant}`, className, ] .filter(Boolean) .join(' '); const hasButtons = primaryButton || secondaryButton; return ( {/* Text section */} {statistic}{superscript && {superscript}} {label} {/* Buttons section */} {hasButtons && ( {primaryButton && ( primaryButton.href ? ( {primaryButton.label} ) : ( {primaryButton.label} ) )} {secondaryButton && ( secondaryButton.href ? ( {secondaryButton.label} ) : ( {secondaryButton.label} ) )} )} ); }; export default CardStat;