All files / atom/slider/src Handler.js

83.33% Statements 5/6
50% Branches 1/2
100% Functions 1/1
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33              1x 3x 3x           3x             1x                    
import {useRef} from 'react'
 
import cx from 'classnames'
import PropTypes from 'prop-types'
 
import {BASE_CLASS, Handle, SliderTooltip} from './settings.js'
 
const Handler = ({value, dragging, refAtomSlider, hideTooltip, className: handleClassName, ...restProps}) => {
  const refHandle = useRef()
  Iif (hideTooltip) {
    return (
      <Handle ref={refHandle} value={value} {...restProps} className={cx(`${BASE_CLASS}-handle`, handleClassName)} />
    )
  }
 
  return (
    <SliderTooltip prefixCls="rc-slider-tooltip" overlay={value} placement="top" visible>
      <Handle ref={refHandle} value={value} {...restProps} className={cx(`${BASE_CLASS}-handle`, handleClassName)} />
    </SliderTooltip>
  )
}
 
Handler.propTypes = {
  /** value  */
  value: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]),
  dragging: PropTypes.bool,
  refAtomSlider: PropTypes.func,
  hideTooltip: PropTypes.bool,
  className: PropTypes.string
}
 
export default Handler