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

[docs] Migrate TreeView demos #26146

Merged
merged 4 commits into from
May 6, 2021
Merged

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented May 5, 2021

@mui-pr-bot
Copy link

mui-pr-bot commented May 5, 2021

No bundle size changes

Generated by 🚫 dangerJS against ec528e8

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

looks good

content: {
const StyledTreeItemRoot = experimentalStyled(TreeItem)(({ theme }) => ({
color: theme.palette.text.secondary,
[`& .${treeItemClasses.content}`]: {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, it's seems that we didn't use them in the past. What should we do going forward?

Copy link
Member Author

Choose a reason for hiding this comment

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

My thinking was, if there are more styles, especially with multiple keys to style a component, styled() looked like the better replacement (I just replaced the keys in the classes with the classes selectors). For trivial, one line changes I used the sx prop.

Copy link
Member

Choose a reason for hiding this comment

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

I like the concept of being able to trust already defined class names instead of typing and making a mistake on it.

It looks interesting to use the same technique that is already used in the creation of the component.

Copy link
Member

Choose a reason for hiding this comment

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

My point was exactly on what @vicasas, the use of the classes object. No real preferences. I like how a plain string is YOLO and often good enough, but I also understand how having a JS object with IntelliSense that describe what each key is for can also help.

docs/src/pages/components/tree-view/GmailTreeView.tsx Outdated Show resolved Hide resolved
docs/src/pages/components/tree-view/GmailTreeView.tsx Outdated Show resolved Hide resolved
@oliviertassinari oliviertassinari added component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation labels May 5, 2021
@oliviertassinari
Copy link
Member

cc @vicasas that has worked on this type of efforts so far, in case he wants to review.

mnajdova and others added 2 commits May 5, 2021 18:18
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
'Mui-expanded': expanded,
'Mui-selected': selected,
'Mui-focused': focused,
'Mui-disabled': disabled,
Copy link
Member

Choose a reason for hiding this comment

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

Interesting, for another example I remember that I used another form that perhaps should be discussed.

https://github.com/mui-org/material-ui/blob/58c7e708a419bc8895774e964b8ef00b55d045ac/docs/src/pages/components/cards/RecipeReviewCard.tsx#L23

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is a bit of a different use-case, but I see your point. I would say that for the pseudo states, we should always rely on the pseudo classes, as we do with the core components, as sometimes it would be impossible to override some css rules if we don't bump the specificity when overriding.

For example, for the disabled state, the core components are defining the styles with:

'&.Mui-disabled': { ... },

If we don't bump the specificity in the overrides, we won't be able to override.

@mnajdova mnajdova merged commit 925bbaf into mui:next May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants