diff --git a/src/entities/activity/ui/items/SliderItem.tsx b/src/entities/activity/ui/items/SliderItem.tsx index 2e15e123c..84152973e 100644 --- a/src/entities/activity/ui/items/SliderItem.tsx +++ b/src/entities/activity/ui/items/SliderItem.tsx @@ -1,3 +1,5 @@ +import Box from '@mui/material/Box'; + import { SliderItem as SliderItemType } from '../../lib'; import { SliderItemBase } from '~/shared/ui'; @@ -17,19 +19,21 @@ export const SliderItem = ({ value, item, onValueChange, isDisabled }: SliderIte }; return ( - + + + ); }; diff --git a/src/shared/ui/Items/Slider/index.tsx b/src/shared/ui/Items/Slider/index.tsx index c3b4ce1cd..11a18d159 100644 --- a/src/shared/ui/Items/Slider/index.tsx +++ b/src/shared/ui/Items/Slider/index.tsx @@ -1,10 +1,10 @@ import { useMemo } from 'react'; +import Box from '@mui/material/Box'; import Slider from '@mui/material/Slider'; import { Theme } from '~/shared/constants'; - -import './style.css'; +import { useCustomMediaQuery } from '~/shared/utils'; type Props = { minImage: string | null; @@ -41,6 +41,8 @@ export const SliderItemBase = (props: Props) => { showStickMarks, } = props; + const { lessThanSM } = useCustomMediaQuery(); + const defaultStep = 1; const marksAndLabelsList = useMemo(() => { @@ -54,7 +56,7 @@ export const SliderItemBase = (props: Props) => { }, [maxValue, minValue]); return ( -
+ { disabled={disabled} marks={showStickLabel ? marksAndLabelsList : true} // The settings behavior: If boolean, marks will be evenly spaced based on the value of step. If an array, it should contain objects with value and an optional label keys. step={continiusSlider ? 0.1 : defaultStep} - valueLabelDisplay="auto" + valueLabelDisplay={continiusSlider ? 'off' : 'auto'} onChange={(e, value) => onChange(String(value))} sx={{ height: '8px', @@ -115,18 +117,40 @@ export const SliderItemBase = (props: Props) => { }} /> -
-
+ + img': { borderRadius: '8px', overflow: 'hidden' }, + }} + > {minImage && } - {minLabel &&
{minLabel}
} -
-
+ {minLabel && ( + + {minLabel} + + )} + + img': { borderRadius: '8px', overflow: 'hidden' }, + }} + > {maxImage && } - {maxLabel &&
{maxLabel}
} -
-
-
+ {maxLabel && ( + + {maxLabel} + + )} + + + ); }; diff --git a/src/shared/ui/Items/Slider/style.css b/src/shared/ui/Items/Slider/style.css deleted file mode 100644 index 672028ddb..000000000 --- a/src/shared/ui/Items/Slider/style.css +++ /dev/null @@ -1,39 +0,0 @@ -.slider-widget { - width: 80%; - margin: auto; -} - -.slider-widget .ticks { - display: flex; - justify-content: space-between; - padding: 5px; -} - -.slider-widget .ticks .tick { - height: 10px; - width: 1px; - background: black; - display: flex; - justify-content: center; - line-height: 40px; -} - -.slider-description { - display: flex; - justify-content: space-between; -} - -.slider-description .label, -.slider-description .label { - text-align: center; -} - -.slider-description .first { - position: relative; - transform: translateX(-50%); -} - -.slider-description .last { - position: relative; - transform: translateX(50%); -}