2016-12-18 20:08:20 +01:00
|
|
|
import React from 'react'
|
|
|
|
import inputStyle from './input.js'
|
|
|
|
|
|
|
|
class BooleanField extends React.Component {
|
|
|
|
static propTypes = {
|
|
|
|
onChange: React.PropTypes.func.isRequired,
|
|
|
|
name: React.PropTypes.string.isRequired,
|
|
|
|
value: React.PropTypes.bool,
|
|
|
|
doc: React.PropTypes.string,
|
2016-12-19 16:21:22 +01:00
|
|
|
style: React.PropTypes.object,
|
2016-12-18 20:08:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-12-19 16:30:48 +01:00
|
|
|
return <input
|
|
|
|
type="checkbox"
|
|
|
|
style={{
|
|
|
|
...inputStyle.checkbox,
|
|
|
|
...this.props.style
|
|
|
|
}}
|
|
|
|
value={this.props.value}
|
|
|
|
onChange={e => {this.props.onChange(!this.props.value)}}
|
|
|
|
checked={this.props.value}
|
|
|
|
>
|
|
|
|
</input>
|
2016-12-18 20:08:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BooleanField
|