Skip to content

Commit

Permalink
[module_manager] remove extra padding on selectelement for dynamictab…
Browse files Browse the repository at this point in the history
…le (#6717)

Resolves unnecessary padding to SelectElement components used inside the DynamicTable component.

    Resolves #6697
  • Loading branch information
maltheism committed Jun 15, 2020
1 parent 71f77ea commit 7655efe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions jsx/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ class SelectElement extends Component {
let errorMessage = null;
let emptyOptionHTML = null;
let requiredHTML = null;
let elementClass = 'row form-group';
let elementClass = this.props.noMargins ? '' : 'row form-group';

// Add required asterisk
if (required) {
Expand All @@ -445,7 +445,7 @@ class SelectElement extends Component {
// Add error message
if (this.props.hasError || (this.props.required && this.props.value === '')) {
errorMessage = <span>{this.props.errorMessage}</span>;
elementClass = 'row form-group has-error';
elementClass = elementClass + ' has-error';
}

let newOptions = {};
Expand Down Expand Up @@ -477,7 +477,7 @@ class SelectElement extends Component {
// and retain formatting. If label prop is not provided at all, the input
// element will take up the whole row.
let label = null;
let inputClass = 'col-sm-12';
let inputClass = this.props.noMargins ? '' : 'col-sm-12';
if (this.props.label && this.props.label != '') {
label = (
<label className="col-sm-3 control-label" htmlFor={this.props.label}>
Expand Down Expand Up @@ -528,6 +528,7 @@ SelectElement.propTypes = {
hasError: PropTypes.bool,
errorMessage: PropTypes.string,
onUserInput: PropTypes.func,
noMargins: PropTypes.bool,
};

SelectElement.defaultProps = {
Expand All @@ -545,6 +546,7 @@ SelectElement.defaultProps = {
onUserInput: function() {
console.warn('onUserInput() callback is not set');
},
noMargins: false,
};

/**
Expand Down
2 changes: 1 addition & 1 deletion modules/module_manager/jsx/modulemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class ModuleManagerIndex extends Component {
options={{'Y': 'Yes', 'N': 'No'}}
value={cell}
onUserInput={this.toggleActive}
noMargins={true}
/></td>;
}
cell = this.mapColumn(column, cell);
Expand Down Expand Up @@ -176,7 +177,6 @@ class ModuleManagerIndex extends Component {
fields={fields}
getFormattedCell={this.formatColumn}
/>

);
}
}
Expand Down

0 comments on commit 7655efe

Please # to comment.