Skip to content

Commit 5d3a3e9

Browse files
committed
feat(pf4): show meta.warnings
1 parent c88d102 commit 5d3a3e9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/pf4-component-mapper/src/common/form-group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const FormGroup = ({ label, isRequired, helperText, meta, description, hideLabel
99
isRequired={isRequired}
1010
label={!hideLabel && label}
1111
fieldId={id}
12-
helperText={helperText}
12+
helperText={(meta.touched && meta.warning) || helperText}
1313
helperTextInvalid={meta.error}
1414
{...showError(meta)}
1515
{...FormGroupProps}
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1-
const showError = ({ error, touched }) => ({ validated: touched && error ? 'error' : 'default' });
1+
const showError = ({ error, touched, warning }) => {
2+
if (touched && error) {
3+
return { validated: 'error' };
4+
}
5+
6+
if (touched && warning) {
7+
return { validated: 'warning' };
8+
}
9+
10+
return { validated: 'default' };
11+
};
212

313
export default showError;

0 commit comments

Comments
 (0)