-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Breadcrumbs][Divider] Replace decimal spacing values with integers and css calc #29526
[Breadcrumbs][Divider] Replace decimal spacing values with integers and css calc #29526
Conversation
* replace decimal values passed to `theme.spacing()` with integers * use css `calc()` to calculate final value
* replace decimal values passed to `theme.spacing()` with integers * use css `calc()` to calculate final value
N.B. This change affects two components, but I wasn't sure how to reference them both in the PR title (as per contributing guidelines). However, I kept the individual commits separated by component, and mentioned the component names in the commit messages. |
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 good to me 👍
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.
Would it make more sense to fix the logic in createSpacing.ts
? It seems like the bug is in theme.spacing
, not how components use it.
I could be wrong here, but it seems to me that the origin of the error message...
...is this issue: #23187 This seems very intentional to me; i.e. MUI specifically supports an array type for the spacing options, and — when spacing is indeed an array — values passed to |
I got your point. 2 solutions that I see
option 1 will hurt us in the long term because we might miss it in other components and some people will open the same issues, so I favor option 2. Right now, I am good with this PR because it fixes what we have missed. However, can you create another issue to discuss about the option 2, if that makes sense? |
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.
👍 Thanks for your first contribution!
Totally agree. The I'll create a new issue as requested, shortly.
My pleasure. Happy to contribute to this wonderful project! |
Sorry, didn't mean to close the PR with unmerged changes |
For context, we had a couple of discussions in the past on whether it makes sense to use |
👍 for supporting half values: e.g. 0.5, 1.5. It's very handy when you have to split the spacing in two between margin-top and margin-bottom. It's also easy to compute when spacing is an array, the logic can be: Do you want to open a new issue for the system? This could be a great follow-up to improve the DX. |
Replace decimal values passed to
theme.spacing()
with integerstheme.spacing()
and csscalc()
arithmetic to obtain final valueBreadcrumbCollapsed
,DividerWrapper