maputnik/src/fields/boolean.jsx

28 lines
691 B
React
Raw Normal View History

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,
}
render() {
return <div style={inputStyle.property}>
<label style={inputStyle.label}>{this.props.name}</label>
<input
type="checkbox"
style={inputStyle.checkbox}
value={this.props.value}
onChange={e => {this.props.onChange(!this.props.value)}}
checked={this.props.value}
>
</input>
</div>
}
}
export default BooleanField