import React from 'react'; import { Card } from '../Card'; import { Badge } from '../Badge'; import { Progress } from '../Progress'; import { Divider } from '../Divider'; import { Icon } from '../Icon'; export interface MetricItem { id: string; label: string; value: string | number; previousValue?: string | number; delta?: string; trend?: 'up' | 'down' | 'neutral'; benchmark?: number; unit?: string; } export interface MetricComparisonGridProps extends React.HTMLAttributes { metrics: MetricItem[]; title?: string; } export function MetricComparisonGrid({ metrics, title = 'مقارنة المؤشرات', className = '', ...props }: MetricComparisonGridProps) { const trendTone = (t?: string) => t === 'up' ? 'success' : t === 'down' ? 'danger' : 'neutral'; return (
{metrics.map((m) => ( {/* Header */}
{m.label} {m.delta && ( {m.trend === 'up' && ( )} {m.trend === 'down' && ( )} {m.delta} )}
{/* Value */}
{m.value} {m.unit && ( {m.unit} )}
{/* Previous Value */} {m.previousValue !== undefined && ( <>
الفترة السابقة {m.previousValue}
)} {/* Benchmark Bar */} {m.benchmark !== undefined && ( )}
))}
); }