blob: 8932fbd137a23ca145b5085822587b0a82fef8e8 (
plain)
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
34
35
36
37
38
39
40
|
import { h, Component } from 'preact'
import { connect } from 'react-redux'
class Slider extends Component {
render(){
const props = this.props
const name = props.name
const title = props.title || name.replace(/_/g, ' ')
let step;
if (props.type === 'int') {
step = 1
} else {
step = (props.max - props.min) / 100
}
return (
<div class='slider'>
<label>
<span>{title}</span>
<input type='text'
/>
</label>
<input
type='range'
min={props.min}
max={props.max}
step={step}
/>
</div>
)
}
}
const mapStateToProps = state => ({
})
const mapDispatchToProps = (dispatch, ownProps) => ({
...ownProps,
})
export default connect(mapStateToProps, mapDispatchToProps)(Slider)
|