mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-10 00:51:47 +01:00
26 lines
584 B
JavaScript
26 lines
584 B
JavaScript
import React from 'react'
|
|
import input from '../../config/input'
|
|
|
|
/** Wrap a component with a label */
|
|
class InputBlock extends React.Component {
|
|
static propTypes = {
|
|
label: React.PropTypes.string.isRequired,
|
|
children: React.PropTypes.element.isRequired,
|
|
}
|
|
|
|
onChange(e) {
|
|
const value = e.target.value
|
|
return this.props.onChange(value === "" ? null: value)
|
|
}
|
|
|
|
render() {
|
|
return <div style={{
|
|
display: 'block'
|
|
}}>
|
|
<label style={input.label}>{this.props.label}</label>
|
|
{this.props.children}
|
|
</div>
|
|
}
|
|
}
|
|
|
|
export default InputBlock
|