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
[system] Add Container
component and createContainer
factory
#32263
Conversation
@material-ui/core: parsed: +0.10% , gzip: +0.09% |
@@ -13,6 +13,8 @@ describe('@mui/joy', () => { | |||
}); | |||
|
|||
it('should not have undefined exports', () => { | |||
Object.keys(joy).forEach((exportKey) => expect(Boolean(joy[exportKey])).to.equal(true)); | |||
Object.keys(joy).forEach((exportKey) => |
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.
Just to improve the error message to something more meaningful
To be merged after #32456 |
I have 3 points from my side: Folder structure:I think the /container/
- createContainer.tsx (should we go with .tsx as first choice?)
- container.tsx Otherwise, when we have other components like Grid, Stack, ...etc. Every And in Joy, Material UI we can import it like: import { createContainer } from '@mui/system/Container'; same as
|
Agree, makes sense to me 👍
Makes sense, I didn't envision that the components would have different names, but if this is used in userland, it may be a valid use-case. Will update the PR.
As the base package is not stable, we could move the classes utils to a different package, but I would export them still from base, at least for one release, so that we give a chance to the X team to update their imports paths (and we would need to do the same in the Mateiral UI (and Joy UI?) components. (I will draft a PR for this today) |
I think we should reexport them from all packages, Material UI, Joy, System, Base. Users should not know about this classname internal package (let's say that it is for internal usage between packages for now). These are what I think should be inside the package:
|
/** | ||
* Override or extend the styles applied to the component. | ||
*/ | ||
classes?: Partial<ContainerClasses>; |
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.
/** | |
* Override or extend the styles applied to the component. | |
*/ | |
classes?: Partial<ContainerClasses>; |
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 guess we don't need classes
anymore (at least for Joy UI)
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!
/** | ||
* Override or extend the styles applied to the component. | ||
*/ | ||
classes?: Partial<ContainerClasses>; |
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 guess we don't need classes
anymore (at least for Joy UI)
...(!ownerState.disableGutters && { | ||
paddingLeft: theme.spacing(2), | ||
paddingRight: theme.spacing(2), | ||
// @ts-ignore module augmentation fails if custom breakpoints are used |
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 had to add bunch of @ts-ignore when using breakpoints, as we have a module augmentation test that fails as these breakpoints do not exits 😅 Not the best, but I don't have a better option for now...
Container
and re-export from other packagesContainer
component and createContainer
factory
Container
component and createContainer
factory Container
component and createContainer
factory
return [ | ||
styles.root, | ||
styles[`maxWidth${capitalize(String(ownerState.maxWidth))}`], | ||
ownerState.fixed && styles.fixed, | ||
ownerState.disableGutters && styles.disableGutters, | ||
]; | ||
}, |
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.
Is this logic only here temporarily until v6? Should we have a TODO comment so we don't forget to remove it at some point?
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 point here is that for Joy and Material UI the overrides resolver are different. In Joy, we do not have style overrides with keys, it is a leftover from Material UI. I will add a comment for updating this in v6.
Adds a
Container
component in the system and re-exports from both Material UI and Joy UI. In addition it fixes a previous problem with the prop types generation (now prop types can be generated for the system components too cc @siriwatknp)https://deploy-preview-32263--material-ui.netlify.app/system/react-container/