-
-
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
[Breadcrumbs] Add ability to change icon used in BreadcrumbCollapsed
through slots
#33812
Conversation
Netlify deploy previewhttps://deploy-preview-33812--material-ui.netlify.app/ Bundle size report |
* } | ||
*/ | ||
components: PropTypes.shape({ | ||
collapsed: PropTypes.elementType, |
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.
collapsed: PropTypes.elementType, | |
Collapsed: PropTypes.elementType, |
Also we need a componentsProps
prop. Take a look at how these are implemented in other Material UI components, as well as in the @mui/base components. One example component is:
* The props used for each slot inside. | ||
* @default {} | ||
*/ | ||
componentsProps?: { |
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 keys in the componentsProps
should be the same as the keys in components
(just lowercased).
const CustomBreadcrumbCollapsedIcon = | ||
components && components.Collapsed ? components.Collapsed : <React.Fragment />; | ||
|
||
const BreadcrumbCollapsedIcon = styled( |
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 needs to be created outside of the parent component. You can use the as
prop for setting up the components.Collapsed
.
<span>first</span> | ||
<span>second</span> | ||
<span>third</span> | ||
<span>fourth</span> | ||
<span>fifth</span> | ||
<span>sixth</span> | ||
<span>seventh</span> | ||
<span>eighth</span> | ||
<span>ninth</span> |
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 we really need tese many elements for the purpose of the test?
No I don't think so |
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.
Check #33797 (comment) We need to come up with a solution to the problem pointed out by @siriwatknp first
We need to use |
Hi @ZeeshanTamboli, let me fix this. |
Hi @ZeeshanTamboli, everything looks good but I'm getting the error of sorting the proptypes
Do we have to sort it manually or have a command for that? Also facing the same issue on #33797 |
BreadcrumbCollapsed
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 pushed the remaining changes. It looks good now. @pratikkarad Thanks for your contribution!
BreadcrumbCollapsed
BreadcrumbCollapsed
through slots
I have tested this fix locally and it works as expected.
Fixes #33232