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

Fix style overrides for Ra* components #7616

Closed

Conversation

sweco-sedalh
Copy link
Contributor

This pull request allows using styleOverrides from MUI themes to override the styles of all classes in react-admin components, as opposed to just the root class previously.

Fixes: #7604

Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there! Sorry I did not see the last point that immediately

packages/ra-ui-materialui/src/makeOverridesResolver.tsx Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/makeOverridesResolver.tsx Outdated Show resolved Hide resolved
@djhi
Copy link
Collaborator

djhi commented May 2, 2022

Have you tried those modifications? I tried converting the demo theme accordingly and it does not seem to work

@vercel vercel bot temporarily deployed to Preview – react-admin May 2, 2022 13:17 Inactive
@sweco-sedalh
Copy link
Contributor Author

Have you tried those modifications? I tried converting the demo theme accordingly and it does not seem to work

I have tested them by using basically the same code as in the sandbox on #7604 applied to the simple example:

const theme = _.merge({}, defaultTheme, {
    components: {
      MuiButton: {
        styleOverrides: {
          root: {
            // works as expected
            border: "5px solid red"
          },
          startIcon: {
            // works as expected
            color: "red"
          }
        }
      },
      RaList: {
        styleOverrides: {
          root: {
            // works as expected
            backgroundColor: "green"
          },
          content: {
            // does not work
            backgroundColor: "red"
          }
        }
      }
    }
  });

I hadn't seen the demo theme before, will try to update it as well (probably should be part of this PR).

@sweco-sedalh
Copy link
Contributor Author

Now the demo theme is updated and works.

@fzaninotto
Copy link
Member

Thanks for your contribution. But I'm -1 for this change, for the reasons I explained in #7604.

@fzaninotto
Copy link
Member

As explained in #7604, we won't merge that change in master. Thanks for your contribution anyway!

@fzaninotto fzaninotto closed this May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom theme: styleOverrides on Ra* components are not applied
3 participants