-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[Badge][material-next] Add Badge component #37850
Conversation
Netlify deploy preview@mui/material-next: parsed: +2.36% , gzip: +1.55% Bundle size reportDetails of bundle changes (Toolpad) |
2afa675
to
d06a348
Compare
Signed-off-by: Diego Andai <diego@mui.com>
0af7743
to
5074265
Compare
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.
Looks great, left few comments for consideration.
|
||
Color options were changed to match Material You: | ||
|
||
- `"default"`, `"info"`, `"success"`, and `"warning"` were removed and are no longer supported out-of-the-box |
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.
Should we still keep these? We dsicussed that it may be useful to define these in the team. cc @danilo-leal
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 discussed with @danilo-leal and we will work on a Material UI Material You theme that makes upgrading smoother (for example, having these colors) and that makes sense with the Material You color system.
I'll be working on developing this, but there are still things to figure out, like for example which would be the default theme, the Material You default theme, or the Material UI MY theme.
I don't want to block the components progress while we figure out the Material UI MY theme, so for now I think we should continue the work using the Material You default theme (which doesn't have these colors) and when we have more clarity we can go back to this. What do you think?
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.
My worry with this is that we would introduce a breaking change and later add back these values. It could be frustrating for people to have to do some changes, and revert them later.
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.
You're right, what we should do then is add the "info"
, "success"
, and "warning"
to the palette following Material You's custom colors guidelines: https://m3.material.io/styles/color/the-color-system/custom-colors.
Regarding the "default"
color, that's not really a color but rather the badge has no background:
Do you think we should keep that one as well?
I'll work with @zanivan on 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.
In v5 we started with removing "default" from the color values, I wonder why it is still there in the Badge
. The reasoning for it was that default
is not a color, we should use as default some valid color value. I propose we drop it.
- `standard` renamed to `large`, which is still the default | ||
- `dot` renamed to `small` |
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 use size
as a name for the sizes. I propose keeping all variant values as deprecated to easy up the migration, and use a new size
prop for this instead. We can deprecate the whole variant
prop with an appropriate deprecation message.
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.
@mnajdova I agree with naming the prop size
.
About keeping the variant
prop, I think it would be better to remove it right away, because:
- Migrating can be covered with a codemod
- Keeping it would complicate and bloat the code
What do you think?
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 feel like we can likely get more people to try it early if we don't introduce many breaking changes with the first version, but happy to experiment with what you suggest.
I see two ways going forward:
- deprecate props and move forward with minimal breaking changes
- introduce breaking changes together with a codemod for them at the moment they are implemented
So we should either, add a codemod now, or deprication, one of these two needs to be implemented.
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.
That makes sense, I'll look into both options and let you know which one I think is better.
9d321f3
to
8da4d2e
Compare
Hey @mnajdova I rolled back both deprecations 😊:
You can check the new colors in the playground: https://deploy-preview-37850--material-ui.netlify.app/material-ui/react-badge/#material-you-version @zanivan the colors are looking great! 🎉 here's a picture of them being used in the badges (in order: A couple of questions regarding the colors:
|
Yep, absolutely! I'll update it on Figma.
I'll change the Hue a bit—I wouldn't saturate it, though. MY seems less saturate, so yellow or orange could be tricky and look a bit off from the others, since those are colors with more perceived light. |
@mnajdova another question, regarding this comment, should we just remove the classes or is there anything else to do? |
'colorTertiary', | ||
'overlapRectangular', | ||
'overlapCircular', | ||
// TODO: v6 remove the overlap value from these class keys |
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.
@DiegoAndai we don't want to have in v6 combination of props in the classes. If someone wants to combine these two, they can create selector containing both classes. Each of the keys in classes
should define one prop + value combination.
@DiegoAndai I tried to bump the warning colors a bit to the yellow tones, I believe it works. Here's the Figma link |
@mnajdova I removed the combined classes, added the corresponding migration section, and updated tests. Here's a sandbox of the new usage creating a CSS selector to combine @zanivan updated the warning 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.
Looks good, left few final comments, nothing big. Well done! The PR description is very detailed, love it!
Co-authored-by: Marija Najdova <mnajdova@gmail.com> Signed-off-by: Diego Andai <diego@mui.com>
Badge issue: #37835
Material You umbrella issue: #29345
Closes #37835
Changes
material
components
andcomponentsProps
Breaking changes
https://github.com/mui/material-ui/pull/37850/files#diff-9548901bac6f3274c402a36fad9b83afe49cf663499e51d9fe306195d149a4a1
CSS Variables
I was heavily inspired by Joy Badge's variables, but didn't use exactly the same. As naming convention, I followed Material You's token convention in which component variables have the
--md-comp
prefix followed by the component's name, so in this case it is:--md-comp-badge
Playground
Link: https://deploy-preview-37850--material-ui.netlify.app/material-ui/react-badge/#material-you-version
Screen.Recording.2023-07-13.at.12.53.41.mov