All files / src/components KpiCards.tsx

100% Statements 22/22
100% Branches 8/8
100% Functions 2/2
100% Lines 22/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                  1x 31x 31x 31x 172x 172x 172x 172x 172x 31x 31x   31x   1x 153x 153x 153x 153x 153x 153x 153x 153x   153x  
import type { ReactNode } from "react";
 
export interface Kpi {
  label: string;
  value: string;
  hint?: string;
  tone?: string;
}
 
export function KpiCards({ items }: { items: Kpi[] }) {
  return (
    <div className="kpi-grid">
      {items.map((item) => (
        <article key={item.label} className={`kpi kpi--${item.tone ?? "neutral"}`}>
          <span className="kpi__label">{item.label}</span>
          <strong className="kpi__value">{item.value}</strong>
          {item.hint ? <span className="kpi__hint">{item.hint}</span> : null}
        </article>
      ))}
    </div>
  );
}
 
export function Panel({ title, actions, children }: { title: string; actions?: ReactNode; children: ReactNode }) {
  return (
    <section className="panel">
      <header className="panel__header">
        <h2>{title}</h2>
        {actions ? <div className="panel__actions">{actions}</div> : null}
      </header>
      <div className="panel__body">{children}</div>
    </section>
  );
}