-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Skeleton][material-ui] Add new props to the Skeleton component #38483
Conversation
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@DiegoAndai this PR is ready for review |
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.
Hey @gitstart, thanks for working on this!
I left some comments for review. Also, we need to add tests:
- Tests for the current variant behavior, so we're sure we're not breaking current behavior
- Test for the new size and shape props
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@DiegoAndai your feedback has been implemented. |
@gitstart the code looks ready to me 🎉 Can you update the Skeleton documentation page? It should reflect that users should use
We also need to merge the |
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
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.
Hey @gitstart, here's a couple fixes that I found reviewing the new documentation
styles[ownerState.shape], | ||
styles[ownerState.size], |
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.
styles[ownerState.shape], | |
styles[ownerState.size], | |
ownerState.shape && styles[ownerState.shape], | |
ownerState.size && styles[ownerState.size], |
@@ -82,7 +83,7 @@ const SkeletonRoot = styled('span', { | |||
? theme.vars.palette.Skeleton.bg | |||
: alpha(theme.palette.text.primary, theme.palette.mode === 'light' ? 0.11 : 0.13), | |||
height: '1.2em', | |||
...(ownerState.variant === 'text' && { | |||
...(ownerState.size === 'text' && { |
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 should remove the borderRadius
style on line 92, as the shape, not the size, should control it.
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@DiegoAndai your feedback has been implemented, thanks for the review. |
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.
Hey @gitstart, so sorry for the delayed review
Here's one last fix (I think) we should do. Let me know if it makes sense to you.
...(ownerState.shape === 'rounded' && { | ||
borderRadius: (theme.vars || theme).shape.borderRadius, | ||
}), |
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.
The "text"
variant was the default, and it had rounded borders. We removed that style from the "text"
styles above, which is correct, but we should keep the being rounded as before.
To achieve this, we should take borderRadius: (theme.vars || theme).shape.borderRadius
out of this conditional, and add it to the base styles. We should add a ownerState.shape === 'rectangular'
conditional style that would set borderRadius: 0
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
Co-authored-by: seunexplicit <48022904+seunexplicit@users.noreply.github.com>
@DiegoAndai your feedback has been implemented. |
Signed-off-by: Diego Andai <diego@mui.com>
Signed-off-by: Diego Andai <diego@mui.com>
Signed-off-by: Diego Andai <diego@mui.com>
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.
Great work @gitstart 👏🏼
I'm very happy to be merging this one 🎉
In terms of behavior, I think it would be great to update the docs to still encourage the use of the This seems to be the same case as in https://mui.com/material-ui/react-alert/ with the severity = color + icon. In the large majority of the cases, the variant should be enough but here might be cases where developers want to unbundle the prop variant = shape + size. Personally, it would be more intuitive for me to use the sx prop over the shape prop, but I can also understand why some people would use it. However, I also think that we should drop the In any cases, #38190 feels like an issue that is for the <10% of the users, so I think we should only slightly change the product for it. |
Description
Added new props to the
Skeleton
component. The props added areAlso deprecated
variant
in favor of the two new props.Closes #38190
This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.