Skip to content

Commit

Permalink
BUG Add support for disabling the smallfield holder label on react Fi…
Browse files Browse the repository at this point in the history
…eldGroup
  • Loading branch information
maxime-rainville committed Oct 22, 2019
1 parent d182f06 commit 57e481f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
16 changes: 15 additions & 1 deletion client/src/components/FieldGroup/FieldGroup.js
@@ -1,12 +1,26 @@
import CompositeField from 'components/CompositeField/CompositeField';
import PropTypes from 'prop-types';
import classnames from 'classnames';

class FieldGroup extends CompositeField {
getClassName() {
return `field-group-component ${super.getClassName()}`;
return classnames(
'field-group-component',
{ 'field-group-component__small-holder': this.props.smallholder },
super.getClassName()
);
}
}

// Field group is essentially a composite field, but wrapped with a typical field holder
// fieldHolder wrapping happens in the FormBuilder component

FieldGroup.propTypes = Object.assign({}, CompositeField.propTypes, {
smallholder: PropTypes.bool
});

FieldGroup.defaultProps = Object.assign({}, CompositeField.defaultProps, {
smallholder: true
});

export default FieldGroup;
8 changes: 4 additions & 4 deletions client/src/components/FieldGroup/FieldGroup.scss
Expand Up @@ -5,11 +5,11 @@
display: inline-block;
margin-right: $spacer / 2;
vertical-align: bottom; // Align fields with no labels
}

.form__field-label {
font-size: $font-size-xs;
color: $text-muted;
}
&__small-holder > .form-group .form__field-label {
font-size: $font-size-xs;
color: $text-muted;
}
}

Expand Down

0 comments on commit 57e481f

Please sign in to comment.