mirror of
https://github.com/maputnik/editor.git
synced 2025-12-26 08:00:01 +00:00
Use DocLabel in input block
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import React from 'react'
|
||||
import input from '../../config/input'
|
||||
import DocLabel from '../fields/DocLabel'
|
||||
import { margins } from '../../config/scales'
|
||||
|
||||
/** Wrap a component with a label */
|
||||
class InputBlock extends React.Component {
|
||||
static propTypes = {
|
||||
label: React.PropTypes.string.isRequired,
|
||||
doc: React.PropTypes.string,
|
||||
children: React.PropTypes.element.isRequired,
|
||||
style: React.PropTypes.object,
|
||||
}
|
||||
@@ -31,6 +33,16 @@ class InputBlock extends React.Component {
|
||||
...input.property,
|
||||
...this.props.style,
|
||||
}}>
|
||||
{this.props.doc &&
|
||||
<DocLabel
|
||||
label={this.props.label}
|
||||
doc={this.props.doc}
|
||||
style={{
|
||||
width: '50%',
|
||||
}}
|
||||
/>
|
||||
}
|
||||
{!this.props.doc &&
|
||||
<label
|
||||
style={{
|
||||
...input.label,
|
||||
@@ -38,6 +50,7 @@ class InputBlock extends React.Component {
|
||||
}}>
|
||||
{this.props.label}
|
||||
</label>
|
||||
}
|
||||
{this.renderChildren()}
|
||||
</div>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user