gab-social/app/javascript/gabsocial/components/slider.js
mgabdev 2202cea0e1 Added Slider component for input range
• Added:
- Slider component for input range
2020-09-02 13:21:11 -05:00

46 lines
791 B
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
class Slider extends React.PureComponent {
handleOnInput = (e) => {
this.props.onInput(e.target.value)
}
handleOnChange = (e) => {
this.props.onChange(e.target.value)
}
render() {
const {
className,
min,
max,
value,
} = this.props
return (
<input
type='range'
min={min}
value={value}
max={max}
onInput={this.handleOnInput}
onChange={this.handleOnChange}
className={className}
/>
)
}
}
Slider.propTypes = {
className: PropTypes.string,
min: PropTypes.number,
max: PropTypes.number,
onChange: PropTypes.func,
onInput: PropTypes.func,
value: PropTypes.number,
}
export default Slider