import React from 'react'; import clsx from 'clsx'; import { TextCard, TextCardProps } from 'shared/components/TextCard'; import { PageGrid } from 'shared/components/PageGrid'; /** * Configuration for a card in the CardsTwoColumn pattern */ export type CardsTwoColumnCardConfig = TextCardProps; /** * Props for the CardsTwoColumn pattern component */ export interface CardsTwoColumnProps extends Omit, 'title'> { /** Section title (heading-md typography) */ title: React.ReactNode; /** Section description (body-l typography, muted color). Can be string or ReactNode */ description?: React.ReactNode; /** Secondary description paragraph (body-l typography, muted color). Can be string or ReactNode */ secondaryDescription?: React.ReactNode; /** Array of 4 card configurations for the 2x2 grid */ cards: readonly [CardsTwoColumnCardConfig, CardsTwoColumnCardConfig, CardsTwoColumnCardConfig, CardsTwoColumnCardConfig]; } /** * CardsTwoColumn Pattern Component * * A section pattern that displays a header with title/description and a 2x2 grid * of TextCard components. Uses PageGrid for responsive layout. * * Structure: * - Header: Title (left) + Description (right) on desktop, stacked on tablet/mobile * - Cards: 2x2 grid on desktop, single column stacked on tablet/mobile * * Responsive behavior: * - Desktop (≥992px): * - Header: Title left (6 cols), description right (6 cols) * - Cards: 2x2 grid (6 cols each) * - Section padding: 40px vertical, 32px horizontal * - Gap between header and cards: 40px * - Gap between cards: 8px * * - Tablet (576-991px): * - Header: Stacked (title above description, full width) * - Cards: Single column, stacked vertically * - Section padding: 32px vertical, 24px horizontal * - Gap between header and cards: 32px * - Gap between cards: 8px * * - Mobile (<576px): * - Header: Stacked (title above description, full width) * - Cards: Single column, stacked vertically * - Section padding: 24px vertical, 16px horizontal * - Gap between header and cards: 24px * - Gap between cards: 8px * * @example * ```tsx * * ``` */ export const CardsTwoColumn = React.forwardRef( (props, ref) => { const { title, description, secondaryDescription, cards, className, ...rest } = props; if (cards.length !== 4) { console.warn('CardsTwoColumn: Exactly 4 cards are required'); return null; } return (
{/* Header Row */}

{title}

{(description || secondaryDescription) && ( {description &&

{description}

} {secondaryDescription &&

{secondaryDescription}

}
)}
{/* Cards Row - 2x2 on desktop, stacked on tablet/mobile */} {cards.map((card, index) => ( ))}
); } ); CardsTwoColumn.displayName = 'CardsTwoColumn'; export default CardsTwoColumn;