-
Notifications
You must be signed in to change notification settings - Fork 841
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
[Emotion] Convert EuiIcon
#5967
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/ |
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
style
and not passing it as an argument to the Emotion styles ([Emotion] ConvertEuiIcon
#5967 (comment)) - Deleting
$euiIconLoadingOpacity
and$euiIconColors
([Emotion] ConvertEuiIcon
#5967 (comment)) - Removing the
euiIcon-isLoaded
className in favor of a data attribute ([Emotion] ConvertEuiIcon
#5967 (comment)) - Removing
&:focus { opacity: 1 }
? ([Emotion] ConvertEuiIcon
#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 <constancecchen@users.noreply.github.com>
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 <constancecchen@users.noreply.github.com>
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
EuiIcon
to Emotion.withEuiTheme, WithEuiThemeProps
so that I can pass thetheme
to emotioneuiIcon-
to see if there was any usage and I could only findeuiIcon-loaded
being used in tests.icon.tsx
was too large due to thetypeToPathMap
object, I decided to move this object to its own filesrc/components/icon/icon_map.ts
.Loading
The
isLoading
icon borders radius was updated toeuiTheme.border.radius.small
Checklist
[ ] 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-inline
and-block
(Logical properties)[ ] Usegap
property to add margin between items if using flex.js
files be converted to TS?euiCanAnimate
QA