| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
.insights-icon { |
| 3 |
inline-size: auto; |
| 4 |
block-size: 1.25rem; |
| 5 |
flex-basis: 22px; |
| 6 |
margin-inline-end: 0.5rem; |
| 7 |
justify-self: center; |
| 8 |
|
| 9 |
/* JavaScript-set numbers; default to 0 */ |
| 10 |
--critical: 0; |
| 11 |
--important: 0; |
| 12 |
--moderate: 0; |
| 13 |
--low: 0; |
| 14 |
/* Add the numbers together, making calculations easier later on */ |
| 15 |
--total: calc(var(--critical) + var(--important) + var(--moderate) + var(--low)); |
| 16 |
border-radius: 3px; |
| 17 |
border: 1px solid var(--pf-t--global--border--color--default); |
| 18 |
/* Use flex here (with auto below) so everything always adds up properly */ |
| 19 |
display: flex; |
| 20 |
flex-direction: column; |
| 21 |
inline-size: 22px; |
| 22 |
block-size: 22px; |
| 23 |
/* Inner gap between colors and border */ |
| 24 |
padding: 1px; |
| 25 |
/* The top border offset is provided by the border of the first block */ |
| 26 |
padding-block-start: 0; |
| 27 |
|
| 28 |
> * { |
| 29 |
/* If there's a value, set to 1px. Otherwise, divide by 0 and it becomes invalid */ |
| 30 |
--pixel-onoff: calc(var(--severity) / var(--severity) * 1px); |
| 31 |
/* Hit severity is mapped to the --servity variable in blocks below. */ |
| 32 |
block-size: calc(var(--severity) / var(--total) * 100%); |
| 33 |
/* Make it stretchy so the math always works out. ("Fudge factor") */ |
| 34 |
flex: auto; |
| 35 |
/* Anti-alias the edges ever-so-slightly */ |
| 36 |
border-radius: 1px; |
| 37 |
/* If there's a value, then there's a gap at top */ |
| 38 |
margin-block-start: var(--pixel-onoff); |
| 39 |
/* If there's a value, always round height up to 1px minimum */ |
| 40 |
min-block-size: var(--pixel-onoff); |
| 41 |
} |
| 42 |
|
| 43 |
&-critical { |
| 44 |
--severity: var(--critical); |
| 45 |
background: #c9190b; |
| 46 |
} |
| 47 |
|
| 48 |
&-important { |
| 49 |
--severity: var(--important); |
| 50 |
background: #ec7a08; |
| 51 |
} |
| 52 |
|
| 53 |
&-moderate { |
| 54 |
--severity: var(--moderate); |
| 55 |
background: #f0ab00; |
| 56 |
} |
| 57 |
|
| 58 |
&-low { |
| 59 |
--severity: var(--low); |
| 60 |
background: #d2d2d2; |
| 61 |
} |
| 62 |
} |