2016-12-18 20:08:20 +01:00
|
|
|
import React from 'react'
|
2017-11-06 16:32:04 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2016-12-18 20:08:20 +01:00
|
|
|
|
2016-12-26 11:48:52 +01:00
|
|
|
class CheckboxInput extends React.Component {
|
2016-12-18 20:08:20 +01:00
|
|
|
static propTypes = {
|
2017-11-06 16:32:04 +01:00
|
|
|
value: PropTypes.bool.isRequired,
|
|
|
|
style: PropTypes.object,
|
|
|
|
onChange: 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}
|
2017-01-10 09:51:18 +01:00
|
|
|
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">
|
2017-01-16 14:58:53 +01:00
|
|
|
<svg style={{
|
|
|
|
display: this.props.value ? 'inline' : 'none'
|
|
|
|
}} 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-26 11:48:52 +01:00
|
|
|
export default CheckboxInput
|