-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrustMeter.jsx
More file actions
30 lines (30 loc) · 1.07 KB
/
Copy pathTrustMeter.jsx
File metadata and controls
30 lines (30 loc) · 1.07 KB
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
30
/**
* Guardian trust score meter. Value always shown as text; the bar is a
* single ember mark on a recessive track.
*/
export default function TrustMeter({ score, compact = false }) {
return (
<div className={compact ? 'w-full' : 'w-full max-w-xs'}>
<div className="flex items-baseline justify-between gap-2">
<span className="text-[11px] font-medium uppercase tracking-wider text-faint">Trust score</span>
<span className={`font-semibold text-cream ${compact ? 'text-sm' : 'text-base'}`}>{score}</span>
</div>
<div
className="mt-1.5 h-1.5 overflow-hidden rounded-full bg-raise"
role="meter"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={score}
aria-label="Guardian trust score derived from enforcement history"
>
<div
className="h-full rounded-full"
style={{
width: `${score}%`,
background: 'linear-gradient(90deg, var(--color-emberdim), var(--color-ember) 70%, var(--color-gold))',
}}
/>
</div>
</div>
);
}