Skip to content
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

Merged
merged 16 commits into from
Mar 16, 2023

Conversation

pratikkarad
Copy link
Contributor

@pratikkarad pratikkarad commented Aug 5, 2022

I have tested this fix locally and it works as expected.

Fixes #33232

@mui-bot
Copy link

mui-bot commented Aug 5, 2022

Netlify deploy preview

https://deploy-preview-33812--material-ui.netlify.app/

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against b4fdce1

@pratikkarad pratikkarad changed the title [Breadcrumb] Add ability to change icons [Breadcrumbs] Add ability to change icons Aug 5, 2022
* }
*/
components: PropTypes.shape({
collapsed: PropTypes.elementType,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?: {
Copy link
Member

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(
Copy link
Member

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.

Comment on lines 110 to 118
<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>
Copy link
Member

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?

@propG
Copy link

propG commented Aug 10, 2022

No I don't think so

Copy link
Member

@mnajdova mnajdova left a 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

@michaldudak michaldudak added the component: breadcrumbs This is the name of the generic UI component, not the React module! label Oct 12, 2022
@ZeeshanTamboli
Copy link
Member

We need to use slots/slotProps. @pratikkarad If you are interested to continue working on this, feel free to re-open it.

@pratikkarad
Copy link
Contributor Author

Hi @ZeeshanTamboli, let me fix this.

@pratikkarad
Copy link
Contributor Author

pratikkarad commented Mar 10, 2023

Hi @ZeeshanTamboli, everything looks good but I'm getting the error of sorting the proptypes

/tmp/material-ui/packages/mui-material/src/Breadcrumbs/BreadcrumbCollapsed.js
74:3 error Prop types declarations should be sorted alphabetically react/sort-prop-types

Do we have to sort it manually or have a command for that?

Also facing the same issue on #33797

@pratikkarad pratikkarad requested review from mnajdova and removed request for hbjORbj March 14, 2023 17:14
@ZeeshanTamboli ZeeshanTamboli added the new feature New feature or request label Mar 16, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [Breadcrumbs] Add ability to change icons [Breadcrumbs] Add ability to change icon used in BreadcrumbCollapsed Mar 16, 2023
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a 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!

@ZeeshanTamboli ZeeshanTamboli changed the title [Breadcrumbs] Add ability to change icon used in BreadcrumbCollapsed [Breadcrumbs] Add ability to change icon used in BreadcrumbCollapsed through slots Mar 16, 2023
@ZeeshanTamboli ZeeshanTamboli merged commit e418627 into mui:master Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: breadcrumbs This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Breadcrumbs] Add ability to change icon used in BreadcrumbCollapsed
6 participants