-
Notifications
You must be signed in to change notification settings - Fork 863
[Emotion] Convert EuiIcon
#5967
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
Conversation
src/components/icon/icon.tsx
Outdated
| // The app icon only gets the .euiIcon--app class if no color is passed or if color="default" is passed | ||
| 'euiIcon--app': isAppIcon && !appIconHasColor, | ||
| 'euiIcon-isLoading': isLoading, | ||
| 'euiIcon-isLoaded': !isLoading && neededLoading, |
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 use in Kibana for tests.
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.
Can we opt to replace this with a data-is-loaded attribute instead of a className (same for data-is-loading), and change the Kibana CSS overrides to target that data selector instead of the class?
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
1 similar comment
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
- by checking for loading state rather than a basic component check
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
src/components/icon/icon.styles.ts
Outdated
| // TODO find out if this is still valid | ||
| // this focus was added 5 years ago | ||
| &:focus { | ||
| opacity: 1; // We often hide icons on hover. Make sure they appear on focus. | ||
| /* background: $euiFocusBackgroundColor; */ | ||
| } |
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.
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 think it's safe to remove the background-color.
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.
is the opacity: 1 still valid as well? I can't personally think of a single scenario where we hide an icon on hover?
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
cee-chen
left a comment
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.
This is looking great so far! I pushed up some minor cleanup, but there's a few larger items (that may need more discussion or that you may have other feelings on) that I think still need to be addressed:
- Re-adding custom colors as
styleand not passing it as an argument to the Emotion styles (#5967 (comment)) - Deleting
$euiIconLoadingOpacityand$euiIconColors(#5967 (comment)) - Removing the
euiIcon-isLoadedclassName in favor of a data attribute (#5967 (comment)) - Removing
&:focus { opacity: 1 }? (#5967 (comment))
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
|
Thanks, @constancecchen for reviewing this PR and for the cleanup. I went through your review and addressed the issues:
|
Co-authored-by: Constance <[email protected]>
|
Fantastic work with the changes!! :) Just 2 small suggestions/comments left and I think this is good to go! |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
Co-authored-by: Constance <[email protected]>
cee-chen
left a comment
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.
🎉 This looks really great! Thanks so much for taking my feedback!
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |
1 similar comment
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5967/ |

Summary
This PR converts
EuiIconto Emotion.withEuiTheme, WithEuiThemePropsso that I can pass thethemeto emotioneuiIcon-to see if there was any usage and I could only findeuiIcon-loadedbeing used in tests.icon.tsxwas too large due to thetypeToPathMapobject, I decided to move this object to its own filesrc/components/icon/icon_map.ts.Loading
The
isLoadingicon borders radius was updated toeuiTheme.border.radius.smallChecklist
[ ] Checked in mobile[ ] Added documentation[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes[ ] Updated the Figma library counterpartThings to look out for when moving styles
[ ] Anything in the backlog that could be a quick fix for that component?[ ] Convert global Sass vars to JS version like sizing[ ] Convert component-specific Sass vars to exported JS versions[ ] Convert side specific padding, margin, and position to-inlineand-block(Logical properties)[ ] Usegapproperty to add margin between items if using flex.jsfiles be converted to TS?euiCanAnimateQA