File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -21,22 +21,28 @@ export function QuotaCard(
2121}
2222
2323function QuotaUsage ( props : { limit : number ; usage : number } ) {
24- let color = "bg-jsr-yellow-400" ;
2524 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+
2629 if ( percent >= 1 ) {
27- color = "bg-red-500" ;
30+ bgColor = "bg-red-500" ;
2831 } else if ( percent > 0.9 ) {
29- color = "bg-orange-400" ;
32+ bgColor = "bg-orange-400" ;
3033 } else if ( percent > 0.8 ) {
31- color = "bg-jsr-yellow-500" ;
34+ bgColor = "bg-jsr-yellow-500" ;
3235 }
3336
3437 return (
3538 < 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+ >
3742 < div
3843 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 } ` }
4046 >
4147 </ div >
4248 </ div >
You can’t perform that action at this time.
0 commit comments