Initial work for new help text implementation.

This commit is contained in:
orangemug
2019-10-19 14:43:27 +01:00
parent 201ecac156
commit a44e757e31
3 changed files with 80 additions and 4 deletions

View File

@@ -18,11 +18,24 @@ class InputBlock extends React.Component {
onChange: PropTypes.func,
}
constructor (props) {
super(props);
this.state = {
showDoc: false,
}
}
onChange(e) {
const value = e.target.value
return this.props.onChange(value === "" ? undefined : value)
}
onToggleDoc = (val) => {
this.setState({
showDoc: val
});
}
render() {
return <div style={this.props.style}
data-wd-key={this.props["data-wd-key"]}
@@ -36,6 +49,7 @@ class InputBlock extends React.Component {
<DocLabel
label={this.props.label}
doc={this.props.doc}
onToggleDoc={this.onToggleDoc}
/>
</div>
}
@@ -52,6 +66,14 @@ class InputBlock extends React.Component {
<div className="maputnik-input-block-content">
{this.props.children}
</div>
{this.props.doc &&
<div
className="maputnik-doc-inline"
style={{display: this.state.showDoc ? '' : 'none'}}
>
{this.props.doc}
</div>
}
</div>
}
}