mirror of
https://github.com/maputnik/editor.git
synced 2025-12-25 15:40:00 +00:00
Introduce custom input elems for modals
This commit is contained in:
26
src/components/inputs/InputBlock.jsx
Normal file
26
src/components/inputs/InputBlock.jsx
Normal file
@@ -0,0 +1,26 @@
|
||||
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
|
||||
Reference in New Issue
Block a user