Skip to content

Commit

Permalink
Clarify current progress percentage calculation and style
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Oct 3, 2022
1 parent 170f486 commit c5db01c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/components/src/slider/slider/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,16 @@ export function useSlider(
[ onFocus ]
);

const currentValue = interpolate(
// Interpolate the current value between 0 and 100, so that it can be used
// to position the slider's thumb correctly.
const progressPercentage = interpolate(
value,
[ numericMin, numericMax ],
[ 0, 100 ]
);
const componentStyles = {
...style,
'--slider--progress': `${ currentValue }%`,
'--slider--progress': `${ progressPercentage }%`,
};

// Generate dynamic class names.
Expand Down

0 comments on commit c5db01c

Please sign in to comment.