Spaces:
Running
Running
File size: 971 Bytes
fba4209 b225f7d 6c68d01 b225f7d fba4209 b225f7d fba4209 | 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 | import React from 'react';
const TONES = {
neutral: 'text-hmi-text',
ok: 'text-hmi-ok',
err: 'text-hmi-err',
warn: 'text-hmi-warn',
accent: 'text-hmi-accent',
};
const StatusCard = ({ title, value, isBoolean = false, tone, className = '' }) => {
const displayValue = isBoolean ? (value ? 'Yes' : 'No') : (value ?? '—');
const resolvedTone = tone || (isBoolean ? (value ? 'ok' : 'err') : 'neutral');
return (
<div className={`border border-hmi-line bg-hmi-panel px-4 py-3 ${className}`}>
<div className="text-[11px] font-medium uppercase tracking-[0.12em] text-hmi-muted">{title}</div>
<div className={`mt-1.5 flex items-center gap-2 font-mono text-2xl font-semibold tabular-nums ${TONES[resolvedTone]}`}>
{isBoolean && (
<span className={`h-2.5 w-2.5 shrink-0 ${value ? 'bg-hmi-ok' : 'bg-hmi-err'}`} aria-hidden="true" />
)}
{displayValue}
</div>
</div>
);
};
export default StatusCard;
|