[Emotion] Remove misc unnecessary args from Emotion style functions#6221
Merged
cee-chen merged 3 commits intoelastic:mainfrom Sep 9, 2022
Merged
[Emotion] Remove misc unnecessary args from Emotion style functions#6221cee-chen merged 3 commits intoelastic:mainfrom
cee-chen merged 3 commits intoelastic:mainfrom
Conversation
- can be quickly accomplished via static keys & a util instead, negating the need for dynamic CSS
- logic can be written in array format instead, negating the need for dynamic CSS - NOTE: I'm leaving `paddingSize` in here as it's used repeatedly in multiple styles, and is an example of how dev readability trumps performance in this instance
- prefer to use CSS for minWidth instead - now that minWidth is in Emotion, we can also obtain the width by extending our size theme vars instead of using a static arbitrary 112px
b686358 to
30fc18a
Compare
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6221/ |
breehall
approved these changes
Sep 9, 2022
Contributor
breehall
left a comment
There was a problem hiding this comment.
This looks good to me. There are no visual differences (as expected) and I understand why we're pulling out each addition parameter from the Emotion styling functions.
Contributor
Author
|
Thanks Bree! |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
See #6213 (comment) for more context
minWidths should be astyletag and not an Emotion class, for the same reason we inline customcolors on components (we're otherwise generating a potentially infinite number of classes)paddingSizeon this can be easily be converted into a static list of keys without sacrificing readabilitydisplayarg can be easily removed in favor of an array conditional instead, but thepaddingSizecannot (this instance is a good example of when dev readability trumps Emotion performance, especially since paddingSize can only be one of 7 options and is not as wildcard as, e.g. minWidth or color)Checklist