@@ -7,8 +7,6 @@ import useTheme from "../useTheme";
77import SliderPropsType , { RefType } from "./types" ;
88import { v4 as uuidv4 } from "uuid" ;
99
10- const isFirefox = navigator . userAgent . indexOf ( "Firefox" ) !== - 1 ;
11-
1210const 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