-
Notifications
You must be signed in to change notification settings - Fork 863
[CSS-in-JS] Granular insertion; Utility component for classes #5853
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
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Can you put together a wiki page (or update an existing one) with how the cache setup would work, both from EUI's perspective (for us+contributors) and from an app's perspective if they want/need to use these specific caches. I think seeing the documentation alongside the code changes will help make sense of the direction. |
|
I haven't considered naming all that much yet. The current state was really just to gauge reaction to using a provider in every component and discuss HOC vs. hook usage. |
|
@constancecchen provided some additional thoughts today on the HOC approach: it would affect all of the snapshots and require |
|
🚢 After today's sync I am on board with the necessity for component-cache HOC wrappers - most of my concerns about snapshots and mounted behavior should ideally transition away in any case with a gradual move away from Enzyme/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
Working on a Kibana compatibility PR right now, which is kind of funky because it currently needs to be based on elastic/kibana#132257 branch so that we don't get false failures. |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
| cache, | ||
| children, | ||
| }: PropsWithChildren<EuiCacheProviderProps>) => { | ||
| return children && cache ? ( |
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.
Just wondering, is it necessary to check for children here or just cache? The ternary fallthrough would just render an empty fragment in any case so maybe I'm overthinking this
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.
Another question while I'm here: should we have a basic set of unit tests for the EuiCacheProvider component?
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.
LGTM! I think my only remaining comments would be maybe unit tests for the new EuiCacheProvider component, but that's optional / I'll leave it up to you.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5853/ |
Summary
Add granular
EuiProviderconfiguration for where to insert which stylesThe
cacheprop can now accept several properties to fine tune control over where Emotion styles get inserted.defaultwill encompass all Emotion styles, including consumer defined appliction styles, not handled by nested cache instances.globalwill scope all EUI global and reset styles.utilitywill scope all EUI utility class styles.A cache instance provided as the sole value will function the same as the
defaultcache. This prevents a breaking change and will be useful for when EUI no longer ships compiled CSS.Docs site
Updates the webpack config to inject the compiled CSS to a certain location: after EUI Emotion styles but before utility classes in the docs.
Takes advantage of the new cache props to order style injection.
Checklist