mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Add rootClassName support
This commit is contained in:
parent
aa2f2e2b00
commit
9ecc928b31
1 changed files with 4 additions and 3 deletions
|
|
@ -10,17 +10,18 @@ import css from './ValidationError.css';
|
|||
* shown.
|
||||
*/
|
||||
const ValidationError = props => {
|
||||
const { className, fieldMeta } = props;
|
||||
const { rootClassName, className, fieldMeta } = props;
|
||||
const { touched, error } = fieldMeta;
|
||||
const classes = classNames(css.root, className);
|
||||
const classes = classNames(rootClassName || css.root, className);
|
||||
return touched && error ? <div className={classes}>{error}</div> : null;
|
||||
};
|
||||
|
||||
ValidationError.defaultProps = { className: '' };
|
||||
ValidationError.defaultProps = { rootClassName: null, className: null };
|
||||
|
||||
const { shape, bool, string } = PropTypes;
|
||||
|
||||
ValidationError.propTypes = {
|
||||
rootClassName: string,
|
||||
className: string,
|
||||
fieldMeta: shape({
|
||||
touched: bool.isRequired,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue