File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -21,22 +21,28 @@ export function QuotaCard(
21
21
}
22
22
23
23
function QuotaUsage ( props : { limit : number ; usage : number } ) {
24
- let color = "bg-jsr-yellow-400" ;
25
24
const percent = props . usage / props . limit ;
25
+
26
+ let bgColor = "bg-jsr-yellow-400" ;
27
+ const ringColor = percent >= 1 ? "ring-red-700" : "ring-jsr-yellow-700" ;
28
+
26
29
if ( percent >= 1 ) {
27
- color = "bg-red-500" ;
30
+ bgColor = "bg-red-500" ;
28
31
} else if ( percent > 0.9 ) {
29
- color = "bg-orange-400" ;
32
+ bgColor = "bg-orange-400" ;
30
33
} else if ( percent > 0.8 ) {
31
- color = "bg-jsr-yellow-500" ;
34
+ bgColor = "bg-jsr-yellow-500" ;
32
35
}
33
36
34
37
return (
35
38
< div class = "mt-4 flex items-center gap-2" >
36
- < div class = "overflow-hidden h-3 w-full rounded bg-jsr-yellow-50 ring-1 ring-jsr-yellow-500" >
39
+ < div
40
+ class = { `overflow-hidden h-3 w-full rounded bg-jsr-yellow-50 ring-1 ${ ringColor } ` }
41
+ >
37
42
< div
38
43
style = { { width : `${ percent * 100 } %` } }
39
- class = { `h-full ${ color } ` }
44
+ // We deduplicate ring classes here to avoid whitespace between "bar" and "ring"
45
+ class = { `h-full ${ bgColor } ring-1 ${ ringColor } ` }
40
46
>
41
47
</ div >
42
48
</ div >
You can’t perform that action at this time.
0 commit comments