diff --git a/src/components/ControlPanel/ControlPane.css b/src/components/ControlPanel/ControlPane.css index 7915b19c..b98f1976 100644 --- a/src/components/ControlPanel/ControlPane.css +++ b/src/components/ControlPanel/ControlPane.css @@ -1,7 +1,7 @@ .control { color: #7c8382; position: relative; - padding: 20px 0; + padding: 20px 0 10px 0; & input, & textarea, @@ -9,7 +9,7 @@ font-family: monospace; display: block; width: 100%; - padding: 0; + padding: 12px 0 10px 0; margin: 0; border: none; outline: 0; @@ -24,7 +24,6 @@ display: block; color: #AAB0AF; font-size: 12px; - margin-bottom: 8px; } .labelWithError { @@ -36,7 +35,7 @@ list-style-type: none; font-size: 10px; color: #FF706F; - margin-bottom: 18px; + margin-bottom: 5px; } .widget { diff --git a/src/components/Widgets/ControlHOC.js b/src/components/Widgets/ControlHOC.js index 81f5ec37..91073519 100644 --- a/src/components/Widgets/ControlHOC.js +++ b/src/components/Widgets/ControlHOC.js @@ -89,6 +89,7 @@ class ControlHOC extends Component { onAddAsset, onRemoveAsset, getAsset, + forID: field.get('name'), ref: this.processInnerControlRef, }); } diff --git a/src/components/Widgets/ListControl.js b/src/components/Widgets/ListControl.js index 282aab0e..242c4966 100644 --- a/src/components/Widgets/ListControl.js +++ b/src/components/Widgets/ListControl.js @@ -29,6 +29,7 @@ export default class ListControl extends Component { onChange: PropTypes.func.isRequired, value: PropTypes.node, field: PropTypes.node, + forID: PropTypes.string.isRequired, getAsset: PropTypes.func.isRequired, onAddAsset: PropTypes.func.isRequired, onRemoveAsset: PropTypes.func.isRequired, @@ -162,15 +163,15 @@ export default class ListControl extends Component { } renderListControl() { - const { value } = this.props; - return (
+ const { value, forID } = this.props; + return (
{value && value.map((item, index) => this.renderItem(item, index))}
); } render() { - const { field } = this.props; + const { field, forID } = this.props; const { value } = this.state; if (field.get('field') || field.get('fields')) { @@ -179,6 +180,7 @@ export default class ListControl extends Component { return ( { + handleChange = (e) => { this.props.onChange(e.target.value); }; render() { - return ; + return ; } } StringControl.propTypes = { onChange: PropTypes.func.isRequired, value: PropTypes.node, + forID: PropTypes.string.isRequired, }; diff --git a/src/components/Widgets/ObjectControl.js b/src/components/Widgets/ObjectControl.js index d3c2ed72..b30021f9 100644 --- a/src/components/Widgets/ObjectControl.js +++ b/src/components/Widgets/ObjectControl.js @@ -11,6 +11,7 @@ export default class ObjectControl extends Component { getAsset: PropTypes.func.isRequired, value: PropTypes.node, field: PropTypes.object, + forID: PropTypes.string.isRequired, }; controlFor(field) { @@ -38,12 +39,12 @@ export default class ObjectControl extends Component { } render() { - const { field } = this.props; + const { field, forID } = this.props; const multiFields = field.get('fields'); const singleField = field.get('field'); if (multiFields) { - return (
+ return (
{multiFields.map(field => this.controlFor(field))}
); } else if (singleField) { diff --git a/src/components/Widgets/RelationControl.js b/src/components/Widgets/RelationControl.js index ee740fc6..5f1de7b4 100644 --- a/src/components/Widgets/RelationControl.js +++ b/src/components/Widgets/RelationControl.js @@ -15,6 +15,7 @@ function escapeRegexCharacters(str) { class RelationControl extends Component { static propTypes = { onChange: PropTypes.func.isRequired, + forID: PropTypes.string.isRequired, value: PropTypes.node, field: PropTypes.node, isFetching: PropTypes.node, @@ -105,12 +106,13 @@ class RelationControl extends Component { }; render() { - const { value, isFetching, queryHits } = this.props; + const { value, isFetching, forID, queryHits } = this.props; const inputProps = { placeholder: '', value: value || '', onChange: this.onChange, + id: forID, }; const suggestions = (queryHits.get) ? queryHits.get(this.controlID, []) : []; diff --git a/src/components/Widgets/SelectControl.js b/src/components/Widgets/SelectControl.js index c6c6a61d..160f24bd 100644 --- a/src/components/Widgets/SelectControl.js +++ b/src/components/Widgets/SelectControl.js @@ -7,7 +7,7 @@ export default class SelectControl extends React.Component { }; render() { - const { field, value } = this.props; + const { field, value, forID } = this.props; const fieldOptions = field.get('options'); if (!fieldOptions) { @@ -21,7 +21,7 @@ export default class SelectControl extends React.Component { return option; }); - return ( {options.map((option, idx) => )} @@ -32,6 +32,7 @@ export default class SelectControl extends React.Component { SelectControl.propTypes = { onChange: PropTypes.func.isRequired, value: PropTypes.node, + forID: PropTypes.string.isRequired, field: ImmutablePropTypes.contains({ options: ImmutablePropTypes.listOf(PropTypes.oneOf([ PropTypes.string, diff --git a/src/components/Widgets/StringControl.js b/src/components/Widgets/StringControl.js index f3922fd6..bba23f13 100644 --- a/src/components/Widgets/StringControl.js +++ b/src/components/Widgets/StringControl.js @@ -1,16 +1,17 @@ import React, { PropTypes } from 'react'; export default class StringControl extends React.Component { - handleChange = e => { + handleChange = (e) => { this.props.onChange(e.target.value); }; render() { - return ; + return ; } } StringControl.propTypes = { onChange: PropTypes.func.isRequired, + forID: PropTypes.string.isRequired, value: PropTypes.node, }; diff --git a/src/components/Widgets/TextControl.js b/src/components/Widgets/TextControl.js index fa3cd17a..57e964a7 100644 --- a/src/components/Widgets/TextControl.js +++ b/src/components/Widgets/TextControl.js @@ -5,27 +5,28 @@ export default class StringControl extends React.Component { this.updateHeight(); } - handleChange = e => { + handleChange = (e) => { this.props.onChange(e.target.value); this.updateHeight(); }; updateHeight() { if (this.element.scrollHeight > this.element.clientHeight) { - this.element.style.height = this.element.scrollHeight + 'px'; + this.element.style.height = `${ this.element.scrollHeight }px`; } } - handleRef = ref => { + handleRef = (ref) => { this.element = ref; }; render() { - return