Skip to content

Commit

Permalink
fix: range slider visual bug on window resized
Browse files Browse the repository at this point in the history
  • Loading branch information
roldanjr authored and sekwah41 committed Dec 20, 2022
1 parent cc8ffec commit 365fda3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions app/renderer/src/styles/components/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,20 @@ export const StyledRangeSliderFill = styled.div<FillTypes>`
top: 0;
left: 0;
width: ${(p) =>
p.maxValue >= 60 && p.value <= 6
? `calc((${p.value} - ${p.minValue}) / (${p.maxValue} - ${p.minValue} - 25) * 100% )`
: `calc((${p.value} - ${p.minValue}) / (${p.maxValue} - ${p.minValue}) * 100%)`};
width: ${({ value, minValue, maxValue }) => {
if (maxValue >= 60 && value <= 6) {
const finalValue =
(value - minValue) / (maxValue - minValue - value);
if (value <= 3) return `calc((${finalValue} * 100%) + 16px)`;
return `calc(${finalValue} * 100%)`;
}
return `calc((${value - minValue} / ${
maxValue - minValue
}) * 100%)`;
}};
height: 0.6rem;
border-radius: 10rem;
Expand Down

0 comments on commit 365fda3

Please sign in to comment.