import type { ReactNode } from 'react' import { Progress } from '@/components/ui/Progress' import { cn } from '@/lib/utils' export type CampaignMetric = { label: string value: string detail?: ReactNode emphasize?: boolean progress?: number valueAriaLabel?: string } /** * Tailwind needs the full class name present in source to generate it — this * map keeps existing 3-metric callers (`sm:grid-cols-3`, unchanged) working * byte-for-byte while giving 4-metric callers (E8 "conta da cadeira") a * balanced 2x2 layout on narrow screens instead of an orphaned 4th cell. */ const gridColsBySize: Record = { 1: 'sm:grid-cols-1', 2: 'sm:grid-cols-2', 3: 'sm:grid-cols-3', 4: 'sm:grid-cols-2 lg:grid-cols-4', } export const CampaignMetricStrip = ({ metrics, className, }: { metrics: CampaignMetric[] className?: string }) => (
{metrics.map((metric) => (
{metric.label}
{metric.value}
{metric.detail ? ( typeof metric.detail === 'string' ? (

{metric.detail}

) : (
{metric.detail}
) ) : null} {metric.progress !== undefined ? ( ) : null}
))}
)