"use client"; import React from "react"; import { KpiItem } from "./types"; interface KpiBarProps { items: KpiItem[]; } export function KpiBar({ items }: KpiBarProps) { const getStrokeDashoffset = (percentage: number) => { const circumference = 264; // 2 * PI * 42 return circumference - (circumference * percentage) / 100; }; const formatValue = (value: number) => { if (value >= 1000) { return value.toLocaleString(); } return value.toString(); }; return (
{items.map((item) => (
{item.percentage}%
{item.label}
{formatValue(item.value)} {item.unit}
))}
); }