Normalize set minPrice and maxPrice values by step (https://github.com/woocommerce/woocommerce-blocks/pull/1379)
* normalize set minPrice and maxPrice values by step * follow standards for comment blocks
This commit is contained in:
parent
5485e4c51c
commit
5ac157b14a
|
@ -81,16 +81,21 @@ const PriceSlider = ( {
|
|||
};
|
||||
}
|
||||
|
||||
// Normalize to whatever is the closest step (because range input will
|
||||
// only jump to the closest step in the range).
|
||||
const min = Math.round( minPrice / step ) * step;
|
||||
const max = Math.round( maxPrice / step ) * step;
|
||||
|
||||
const low =
|
||||
Math.round(
|
||||
100 *
|
||||
( ( minPrice - minConstraint ) /
|
||||
( ( min - minConstraint ) /
|
||||
( maxConstraint - minConstraint ) )
|
||||
) - 0.5;
|
||||
const high =
|
||||
Math.round(
|
||||
100 *
|
||||
( ( maxPrice - minConstraint ) /
|
||||
( ( max - minConstraint ) /
|
||||
( maxConstraint - minConstraint ) )
|
||||
) + 0.5;
|
||||
|
||||
|
@ -104,6 +109,7 @@ const PriceSlider = ( {
|
|||
minConstraint,
|
||||
maxConstraint,
|
||||
hasValidConstraints,
|
||||
step,
|
||||
] );
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue