-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for nodes as a proptype for errors. #685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! Had a couple small comments, and then this looks good to go.
CHANGELOG.md
Outdated
@@ -1,6 +1,7 @@ | |||
## [`master`](https://github.com/elastic/eui/tree/master) | |||
|
|||
- Added `status` prop to `EuiStep` for additional styling ([#673](https://github.com/elastic/eui/pull/673)) | |||
- Add support for node as a proptype for EuiForm and EuiFormRow errors. ([#685](https://github.com/elastic/eui/pull/685)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we change the note to this? (wrapped the component names in backticks and made the note a bit terser)
`EuiForm` and `EuiFormRow` now accept nodes for `errors` prop
src/components/form/form.js
Outdated
@@ -54,5 +54,5 @@ export const EuiForm = ({ | |||
|
|||
EuiForm.propTypes = { | |||
isInvalid: PropTypes.bool, | |||
error: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), | |||
error: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string), PropTypes.node]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify this a bit, since node
is a blanket propType which accepts strings, elements, and arrays:
error: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
@@ -150,7 +150,7 @@ EuiFormRow.propTypes = { | |||
label: PropTypes.node, | |||
id: PropTypes.string, | |||
isInvalid: PropTypes.bool, | |||
error: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), | |||
error: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string), PropTypes.node]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I've been getting a few of these warnings while running tests in Cloud.
They're being caused because the error passed is a node (rather than the currently accepted string or array of strings. I spoke to @pugnascotia and @cjcenizal who agreed that we should allow node as a PropType too.