Skip to content

Commit 5dd2266

Browse files
authored
Merge pull request #1791 from dxc-technology/gomezivann/slider-updates
Slider update
2 parents 7c194f8 + d5b3eac commit 5dd2266

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/src/slider/Slider.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import useTheme from "../useTheme";
77
import SliderPropsType, { RefType } from "./types";
88
import { v4 as uuidv4 } from "uuid";
99

10-
const isFirefox = navigator.userAgent.indexOf("Firefox") !== -1;
11-
1210
const DxcSlider = React.forwardRef<RefType, SliderPropsType>(
1311
(
1412
{
@@ -36,6 +34,7 @@ const DxcSlider = React.forwardRef<RefType, SliderPropsType>(
3634
const [innerValue, setInnerValue] = useState(defaultValue ?? 0);
3735
const [dragging, setDragging] = useState(false);
3836
const colorsTheme = useTheme();
37+
const isFirefox = navigator?.userAgent.indexOf("Firefox") !== -1;
3938

4039
const minLabel = useMemo(
4140
() => (labelFormatCallback ? labelFormatCallback(minValue) : minValue),
@@ -48,10 +47,11 @@ const DxcSlider = React.forwardRef<RefType, SliderPropsType>(
4847
);
4948

5049
const tickMarks = useMemo(() => {
51-
const ticks = [];
5250
const numberOfMarks = Math.floor(maxValue / step - minValue / step);
53-
let index = 0;
5451
const range = maxValue - minValue;
52+
const ticks = [];
53+
let index = 0;
54+
5555
if (marks) {
5656
while (index <= numberOfMarks) {
5757
ticks.push(
@@ -65,9 +65,7 @@ const DxcSlider = React.forwardRef<RefType, SliderPropsType>(
6565
index++;
6666
}
6767
return ticks;
68-
} else {
69-
return null;
70-
}
68+
} else return null;
7169
}, [minValue, maxValue, step, value, innerValue]);
7270

7371
const handleSliderChange = (event) => {
@@ -371,4 +369,4 @@ const StyledTextInput = styled.div`
371369
max-width: 70px;
372370
`;
373371

374-
export default DxcSlider;
372+
export default DxcSlider;

0 commit comments

Comments
 (0)