blob: 2d808c2c1ae08b8e8abfcdd18f574cd01e4c5583 (
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
41
|
import { h, Component } from 'preact'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as liveActions from '../live/live.actions'
class Checkbox extends Component {
constructor(props){
super(props)
this.handleClick = this.handleClick.bind(this)
}
handleClick(e){
clearTimeout(this.timeout)
let new_value = e.target.checked
this.props.onToggle && this.props.onToggle(new_value)
}
render() {
const checked = this.props.value
const dim = !this.props.noDim
return (
<div className='checkbox param'>
<label>
<span>{this.props.title}</span>
<input
type='checkbox'
onClick={this.handleClick}
checked={checked}
/>
</label>
</div>
)
}
}
const mapStateToProps = state => ({
})
const mapDispatchToProps = (dispatch, ownProps) => ({
// actions: bindActionCreators(liveActions, dispatch)
})
export default connect(mapStateToProps, mapDispatchToProps)(Checkbox)
|