Skip to content

[DataGrid] Replace style-components with @material-ui/styles#168

Merged
dtassone merged 31 commits into
mui:masterfrom
dtassone:cssModules
Sep 10, 2020
Merged

[DataGrid] Replace style-components with @material-ui/styles#168
dtassone merged 31 commits into
mui:masterfrom
dtassone:cssModules

Conversation

@dtassone

@dtassone dtassone commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

@dtassone
dtassone marked this pull request as draft August 13, 2020 16:56
Comment thread babel.config.js Outdated
Comment thread tsconfig.json Outdated
Comment thread packages/storybook/package.json Outdated

@oliviertassinari oliviertassinari left a comment

Copy link
Copy Markdown
Member

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.

Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/columns-container.tsx Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/styles.module.css Outdated
@oliviertassinari oliviertassinari added the scope: data grid Changes related to the data grid. label Aug 13, 2020
@oliviertassinari oliviertassinari changed the title [CSS-Modules] Remove style-components, add css modules [DataGrid] Remove style-components, add css modules Aug 13, 2020
@dtassone
dtassone marked this pull request as ready for review September 7, 2020 15:18
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated

@oliviertassinari oliviertassinari left a comment

Copy link
Copy Markdown
Member

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

Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/storybook/.storybook/main.js
Comment thread packages/grid/x-grid-modules/src/hooks/root/useEvents.ts
Comment thread packages/grid/x-grid-modules/src/constants/cssClassesConstants.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated

@oliviertassinari oliviertassinari left a comment

Copy link
Copy Markdown
Member

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

Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx Outdated
Comment thread packages/grid/x-grid-modules/src/constants/cssClassesConstants.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/grid-root.tsx Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/styled-wrappers/getStyles.ts Outdated
Comment thread packages/grid/x-grid-modules/src/components/watermark.tsx Outdated
@oliviertassinari oliviertassinari added the type: new feature Expand the scope of the product to solve a new problem. label Sep 8, 2020
@oliviertassinari

Copy link
Copy Markdown
Member

I have updated the pull request's description to link all the related issues to the pull request.

@oliviertassinari oliviertassinari changed the title [DataGrid] Remove style-components, add css modules [DataGrid] Replace style-components with @material-ui/styles Sep 8, 2020
@oliviertassinari oliviertassinari removed their assignment Sep 8, 2020

@oliviertassinari oliviertassinari left a comment

Copy link
Copy Markdown
Member

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.

@oliviertassinari

Copy link
Copy Markdown
Member

@dtassone Could you double-check my changes? A couple of things we can still do to improve the UI:

  1. Update the docs configuration to use @material-ui/core v4, not v5. I haven't looked where this happens with the documentation. It would fix:

Capture d’écran 2020-09-10 à 14 09 27

Capture d’écran 2020-09-10 à 14 09 21

  1. I think that we will need to push the reflection further on what's the correct behavior for the focus-visible/outline.

@dtassone

Copy link
Copy Markdown
Contributor Author

@dtassone Could you double-check my changes? A couple of things we can still do to improve the UI:

  1. Update the docs configuration to use @material-ui/core v4, not v5. I haven't looked where this happens with the documentation. It would fix:
Capture d’écran 2020-09-10 à 14 09 27 Capture d’écran 2020-09-10 à 14 09 21
  1. I think that we will need to push the reflection further on what's the correct behavior for the focus-visible/outline.

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

@oliviertassinari

oliviertassinari commented Sep 10, 2020

Copy link
Copy Markdown
Member

It would have been better to create a feature branch on upstream and iterate on this one.

I can still do that if you would like.

It's not easy to see what has changed and understand why it has

You can see the full diff along with detailed commits at 883c789...8640691.

Not sure what happened with the number and the sort icon

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.

@dtassone

dtassone commented Sep 10, 2020

Copy link
Copy Markdown
Contributor Author

It would have been better to create a feature branch on upstream and iterate on this one.

I can still do that if you would like.

Let's merge and create another PR for future changes

It's not easy to see what has changed and understand why it has

You can see the full diff along with detailed commits at 883c789...8640691.

I didn't know the trick! But not ideal to comment...

Not sure what happened with the number and the sort icon

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.

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?

@dtassone
dtassone merged commit 13b4a58 into mui:master Sep 10, 2020
@oliviertassinari

Copy link
Copy Markdown
Member

Let's merge and create another PR for future changes

Ok!

I didn't know the trick! But not ideal to comment...

True, only work for small changes, I think that after +-100 it starts to be questionable.

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?

It has something to do with using the docs components from the mono-repo. I can't tell without investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: data grid Changes related to the data grid. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

2 participants