maputnik/src/components/inputs/CheckboxInput.jsx

29 lines
756 B
React
Raw Normal View History

2016-12-18 20:08:20 +01:00
import React from 'react'
class CheckboxInput extends React.Component {
2016-12-18 20:08:20 +01:00
static propTypes = {
value: React.PropTypes.bool.isRequired,
2016-12-19 16:21:22 +01:00
style: React.PropTypes.object,
onChange: React.PropTypes.func,
2016-12-18 20:08:20 +01:00
}
render() {
2017-01-11 11:35:33 +01:00
return <label className="maputnik-checkbox-wrapper">
2016-12-21 10:25:32 +01:00
<input
2017-01-10 21:28:30 +01:00
className="maputnik-checkbox"
2017-01-09 21:43:14 +01:00
type="checkbox"
2017-01-11 11:35:33 +01:00
style={this.props.style}
onChange={e => this.props.onChange(!this.props.value)}
2017-01-09 21:43:14 +01:00
checked={this.props.value}
/>
2017-01-11 11:35:33 +01:00
<div className="maputnik-checkbox-box">
<svg className="maputnik-checkbox-icon" viewBox='0 0 32 32'>
2016-12-21 10:25:32 +01:00
<path d='M1 14 L5 10 L13 18 L27 4 L31 8 L13 26 z' />
</svg>
2017-01-09 21:43:14 +01:00
</div>
</label>
2016-12-18 20:08:20 +01:00
}
}
export default CheckboxInput