I get a data from my HTML and I need to check if this data is inferior to 50, in my SCSS file. But I can't use my var() with a condition. Later this data will become dynamic, that's why I decided to use variable.
HTML:
<div class="pie-wrapper progress-ventilation" style="--progress: 95;"></div>
SCSS:
@mixin draw-progress($progress) {
.pie {
.left-side {
transform: rotate(calc(#{$progress} * 3.6deg));
}
@if $progress <= 50 {
.right-side {
display: none;
}
} @else {
clip: rect(auto, auto, auto, auto);
.right-side {
transform: rotate(180deg);
}
}
}
}
&.progress-ventilation {
$progress-ventilation: var(--progress);
@include draw-progress($progress-ventilation);
}
I tried :
@mixin draw-progress($progress) {
.pie {
.left-side {
transform: rotate(calc(#{$progress} * 3.6deg));
}
@if calc(#{$progress} <= 50) {
.right-side {
display: none;
}
} @else {
clip: rect(auto, auto, auto, auto);
.right-side {
transform: rotate(180deg);
}
}
}
}
&.progress-ventilation {
@include draw-progress(var(--progress);
}