-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[DataGrid] Replace style-components with @material-ui/styles #168
Conversation
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.
Please, only use @material-ui/core/styles until we refactor the styling approach, in v5. This disqualifies CSS modules as a viable option for v4 and until we figure that out.
packages/grid/x-grid-modules/src/components/styled-wrappers/columns-container.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
…tStyles.ts Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
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.
A first pass at the review
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/constants/cssClassesConstants.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
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.
A summary of the propose changes:
- Flatten CSS specificity as much as possible: make overrides easier.
- Use unitless when possible: won't make a large difference, only to match current coding style.
- Remove blank lines: won't make a large difference, only to match the current coding style.
- Use
MuiDataGrid-
to prefix all applied class names. - Use
Mui-
to prefix artificial pseudo-classes. - Hardcoded color prevent customization, e.g. dark theme.
- Use theme.typography variants over cherry-picking values
packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/constants/cssClassesConstants.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts
Outdated
Show resolved
Hide resolved
I have updated the pull request's description to link all the related issues to the pull request. |
…-table But I won't have time to push it further today. For tomorrow 😴
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 progress :)! I have started to continue the pull request to match the style of https://material-ui.com/components/tables/#simple-table. I will finish tomorrow.
@dtassone Could you double-check my changes? A couple of things we can still do to improve the UI:
|
I don't think it's ideal to work on the same PR. It's not easy to see what has changed and understand why it has. It would have been better to create a feature branch on upstream and iterate on this one. AFAIK we were using material ui core 4. Not sure what happened with the number and the sort icon |
I can still do that if you would like.
You can see the full diff along with detailed commits at 883c789...8640691.
I have tried to explain it in the previous comment. It's an issue with the version imported of @material-ui/core (v4 on npm vs. v4 on git). It doesn't impact the end-user (outside of the documentation). We need to use the right version. I can work on it after. |
Let's merge and create another PR for future changes
I didn't know the trick! But not ideal to comment...
Hmm I see. I thought the component would use the npm modules, but if I understand well it uses the code in the repo, due to babel conf? |
Ok!
True, only work for small changes, I think that after +-100 it starts to be questionable.
It has something to do with using the docs components from the mono-repo. I can't tell without investigating. |
https://deploy-preview-168--material-ui-x.netlify.app/components/data-grid/