import { Tag } from 'antd'; import React from 'react'; import { formatNumber } from '../utils/common'; interface MetricCardProps { value?: number; change?: number; label: string; reverseColors?: boolean; format?: (n: number) => string; hideComparison?: boolean; } export const MetricCard: React.FC = React.memo((props) => { const { value = 0, change = 0, label, reverseColors = false, format = formatNumber, hideComparison = false, } = props; return (
{format(value)}
{label} {~~change !== 0 && !hideComparison && ( = 0 ? 'green' : 'red'}> {change > 0 && '+'} {format(change)} )}
); }); MetricCard.displayName = 'MetricCard';