-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Migrates ml-form-label to EUI/React. #21059
Conversation
…ip is available now as a stand-alone component.
Pinging @elastic/ml-ui |
💚 Build Succeeded |
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.
Great stuff. LGTM
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.
A couple of comments, otherwise LGTM
|
||
// directive for creating a form label including a hoverable icon |
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.
Isn't it worth keeping in most of this comment which explains what the component does and just remove the Angular parts?
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.
I adapted the text here in 2073221. I originally copied it to form_label_directive
but you're right of course, once the angular part is gone, we need the comment here.
const { labelId, children } = this.props; | ||
return ( | ||
<React.Fragment> | ||
<label className="kuiFormLabel" id={`ml_aria_label_${labelId}`} ref={this.labelRef}>{children}</label> |
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.
Should this still be using the kuiFormLabel
class? Is there an eui style we can use instead? If you do change the kuiFormLabel
class, the Jest file will need updating too.
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.
In 0bb4939 I updated the component so it defaults to euiFormLabel
but you can override it with another class, for example with kuiFormLabel
when used within an angular context (necessary so we don't end up with mixed styles when a form uses both ml-form-label
and plain labels using kuiFormLabel
).
💚 Build Succeeded |
- Migrates the ml-form-label directive to use EUI/React. - Exposes both FormLabel and JsonTooltip as React components from individual files so they can be used in a React context when the wrapping element also has been already ported to React. - Adds jests based tests for the FormLabel and JsonTooltip components. They try where possible to make the same assertions like the mocha based tests. The mocha based tests are kept in the code for now so the code gets still tested in a angular based context and as a reference to have the same mocha/jest based tests side by side as a reference for migration. - The FormLabel component is done in a way so it supports transclusion in both cases when used with React alone (using the children prop) and angularjs (using a ref callback and angular's transclude()).
- Migrates the ml-form-label directive to use EUI/React. - Exposes both FormLabel and JsonTooltip as React components from individual files so they can be used in a React context when the wrapping element also has been already ported to React. - Adds jests based tests for the FormLabel and JsonTooltip components. They try where possible to make the same assertions like the mocha based tests. The mocha based tests are kept in the code for now so the code gets still tested in a angular based context and as a reference to have the same mocha/jest based tests side by side as a reference for migration. - The FormLabel component is done in a way so it supports transclusion in both cases when used with React alone (using the children prop) and angularjs (using a ref callback and angular's transclude()).
💚 Build Succeeded |
ml-form-label
directive to use EUI/React.FormLabel
andJsonTooltip
as React components from individual files so they can be used in a React context when the wrapping element also has been already ported to React.FormLabel
andJsonTooltip
components. They try where possible to make the same assertions like the mocha based tests. The mocha based tests are kept in the code for now so the code gets still tested in a angular based context and as a reference to have the same mocha/jest based tests side by side as a reference for migration.FormLabel
component is done in a way so it supports transclusion in both cases when used with React alone (using thechildren
prop) and angularjs (using aref
callback and angular'stransclude()
).Part of #21059.