summaryrefslogtreecommitdiff
path: root/app/client/common/checkbox.component.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/common/checkbox.component.js')
-rw-r--r--app/client/common/checkbox.component.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/app/client/common/checkbox.component.js b/app/client/common/checkbox.component.js
new file mode 100644
index 0000000..2d808c2
--- /dev/null
+++ b/app/client/common/checkbox.component.js
@@ -0,0 +1,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)