Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG Add support for disabling the smallfield holder label on react Fi…
…eldGroup
- Loading branch information
1 parent
d182f06
commit 57e481f
Showing
2 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters