[theme] Rename theme keys to defaultProps and styleOverrides#22347
[theme] Rename theme keys to defaultProps and styleOverrides#22347
Conversation
| components: {}, | ||
| }; | ||
|
|
||
| Object.keys(variants).forEach((component) => { |
There was a problem hiding this comment.
The changes to the variants are not part of v4 theme, so that logic was removed
eps1lon
left a comment
There was a problem hiding this comment.
Since it isn't restricted to CSS I'd prefer a more generic name such as stylesOverrides
This would match the vision in https://react-select.com/styles. Maybe?
|
|
Regarding This was the only reason why I went for |
|
Right, the above proposal is in opposition with #21923 (comment). It's motivated by:
|
|
I would say then let's go with the ones proposed from @oliviertassinari
Will update the PR later. @eps1lon do you agree with these names? |
|
I did the renaming |
A bit late to the party (sorry) considering that @mnajdova has already made the change, but I'm not sure about that one. |
@mbrookes not really, we support here only styles for the root, which are applied based on the given props. |
|
That makes sense @oliviertassinari let me revert my reverted changes :D |
|
I've updated the PR description to reflect current state of things, I think we are all on the same page now 👍 |
That isn't true: https://github.com/mui-org/material-ui/pull/22347/files#diff-7df98e40ad908a04619a4dbfbabab223L25-L29 const theme = createMuiTheme({
components: {
MuiButton: {
variants: [
{
props: { variant: 'dashed' },
styles: {
textTransform: 'none',
border: `2px dashed ${defaultTheme.palette.primary.main}`,
color: defaultTheme.palette.primary.main,
},
},
[...]
],
},
},
}); |
|
Those are different variants, we are still always specifying style only for the root, not the slots for for example |
|
I highlighted a single variant with multiple styles, but GitHub screws up the page scroll. While you were replying, I was editing the comment to include the same example, in which |
This comment has been minimized.
This comment has been minimized.
I was not arguing about |
Fair point. |
|
After some thoughts, it look strange that on one place we have |
|
I'm inclined to agree. I think we should go with the simplest most consistent alternative, in the spirit of: "Don't make me think" (design affordance), "principal of least surprise" (UI/UX design), "programmer happiness" (Ruby programming language)... |
This PR continues the work from #22293 by applying the following renaming:
props=>defaultPropsoverrides=>styleOverridesstyles=>style