Skip to content

Commit

Permalink
Change the logic how to highlight the selected value
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Riabkov committed Mar 29, 2024
1 parent 492bc9f commit 1a8ab05
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/shared/ui/Items/Slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export const SliderItemBase = (props: Props) => {
return stickLabels;
}, [maxValue, minValue]);

const selectedValueIndex = marksAndLabelsList.findIndex((item) => item.value === Number(value));

return (
<Box width="100%" margin="auto" className={`slider-widget ${value ? 'no-value' : ''}`}>
<Slider
Expand Down Expand Up @@ -110,7 +112,7 @@ export const SliderItemBase = (props: Props) => {
backgroundColor: Theme.colors.light.primary,
},
},
[`& .MuiSlider-markLabel[data-index="${value}"]`]: {
[`& .MuiSlider-markLabel[data-index="${selectedValueIndex}"]`]: {
color: Theme.colors.light.primary,
fontWeight: 700,
},
Expand Down

0 comments on commit 1a8ab05

Please sign in to comment.