Use DocLabel in input block

This commit is contained in:
Lukas Martinelli
2017-01-09 16:45:59 +01:00
parent d9b458d7fd
commit ba0a94f3ad
5 changed files with 21 additions and 4 deletions

View File

@@ -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>
}