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.
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
RFC: makeStyles() API changes #17076
RFC: makeStyles() API changes #17076
Changes from 15 commits
1b75205
aad4ca0
168ae33
80596b8
a286457
10bc6c2
955b4cb
d5f2c65
895aad6
641269f
020567d
1af8e18
11e4fb6
7084d19
a3dc936
52d0f47
fbf0e28
278c46e
3744775
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 can't find it in the spec anymore, but when I last looked at it, the theming object was passed to each individual 'slot'. Can it just be an argument to a callback for
makeOverrides
first argument?I.e.
instead of
Saves some lambda creation at runtime and in my opinion is a bit more intuitive.
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.
We are considering this option, but there are few open questions.
1. IE11 should have decent performance if there will be a decision to include it into supported browsers, in this case build step can split styles to runtime dependent:
2. Our work related to tokens is not finished yet, we may decide to go with CSS variables (and some magic shim for IE11, if required). But, the open question is why we should have
theme
and closures at all?Once we will have build time transforms, there will be no closures for modern browsers at all in runtime 🐱 Currently this work is done on an initial render, for example:
Will produce this CSS:
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.
[non-blocking] I do quite like this pattern of defining styles ahead of time, then conditionally applying them below. We should measure, but my intuition says that this will have good opportunity for optimization and gets us closer to static styles.
I also find this more intuitive than the matcher approach 👍 I think this will be easier for devs to understand and other teams to use in their products.
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 is one interesting difference:
makeStyles()
) you can just execute a function and get classes backmakeOverrides()
you need to execute component's code to understand applied stylesI am considering this an implementation difference that should not block us from moving forward.
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.
Question: What prevents us from abstracting the component code into a separate function so that we can, like you said, just execute a function and get classes back?
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.
Do you mean something like 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.
Not blocking by any means for this PR but we might want to find a convention for how we name things.
For example, we could go with
[slot] [alphabetically ordered states]
.So, for the example above that would be
rootCircularGhostPrimary
.Just food for thought 😄.