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

Style: React Admin components styles can't be overriden with Material UI theme #3701

Closed
Claire-Cleany opened this issue Sep 17, 2019 · 2 comments

Comments

@Claire-Cleany
Copy link

Is your feature request related to a problem? Please describe.
I would like to modify the appearance of my application using Material UI theme. For some rules, I'd like to use "overrides" key on React-Admin components, but it doesn't work. For instance, the Layout subcomponents appearance.

Describe the solution you'd like
I'd like the React-Admin components styles to be named when withStyles or makeStyles are used, like Material UI are naming their components with the second argument of withstyles/makeStyles.

Describe alternatives you've considered
Material UI tries to use Component.displayName when no style name is found, but none of the components on which makesStyles/withStyles was called seemed to have a displayName when breaking in makeStyles function.

@fzaninotto
Copy link
Member

hi @Claire-Cleany, and thanks for this report.

What you ask is an enhancement, so if we ever implement it, it'll be in the next branch, using material-ui v4. This implies that every time we use makeStyles, we pass an options parameter:

const useStyles = makeStyles({
  foo: {
    textAlign: 'center',
  }
-});
+}, { name: 'FooComponent' });

It's a large change - it requires that we update every component. It can be done little by little, though.

Cf. https://github.com/mui-org/material-ui/blob/daac0562fc008a792356fc83956b5788c8893117/packages/material-ui-styles/src/makeStyles/makeStyles.js#L184

The react-admin core team won't work on that feature for the near future as we don't need it. Feel free to provide a PR if you want it to happen. If this issue receives no community contribution, it will be closed within a few months.

@fzaninotto
Copy link
Member

Fixed by #3946

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

No branches or pull requests

2 participants