File size: 744 Bytes
1c0c94d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import { clamp01, pct } from '../../lib/format.js'
// One labeled confidence bar. `off` greys it out (e.g. VLM not used).
export default function ScoreBar({ label, value, color = '#2563eb', fused = false, off = false }) {
if (off) {
return (
<div className="sbrow off">
<span className="lbl">{label}</span>
<span className="muted">not used</span>
<span className="val">—</span>
</div>
)
}
return (
<div className={`sbrow ${fused ? 'fused' : ''}`}>
<span className="lbl">{label}</span>
<span className="bar">
<i style={{ width: `${pct(clamp01(value))}%`, background: color }} />
</span>
<span className="val">{pct(clamp01(value))}%</span>
</div>
)
}
|