Restyle to use border box

This commit is contained in:
Lukas Martinelli
2016-12-31 12:17:02 +01:00
parent e7709dae15
commit 0eb00312f4
7 changed files with 74 additions and 61 deletions

View File

@@ -15,15 +15,30 @@ class InputBlock extends React.Component {
return this.props.onChange(value === "" ? null: value)
}
renderChildren() {
return React.Children.map(this.props.children, child => {
return React.cloneElement(child, {
style: {
...child.props.style,
width: '50%',
}
})
})
}
render() {
return <div style={{
display: 'block',
marginTop: margins[2],
marginBottom: margins[2],
...input.property,
...this.props.style,
}}>
<label style={input.label}>{this.props.label}</label>
{this.props.children}
<label
style={{
...input.label,
width: '50%',
}}>
{this.props.label}
</label>
{this.renderChildren()}
</div>
}
}