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

Using a design system that is built with MUI under the hood #71

Open
lucastobrazil opened this issue May 19, 2021 · 0 comments
Open

Using a design system that is built with MUI under the hood #71

lucastobrazil opened this issue May 19, 2021 · 0 comments

Comments

@lucastobrazil
Copy link

lucastobrazil commented May 19, 2021

I have a component library ("Motif") that exports components, some of which are built on Mui.

import { Button as MuiButton } from '@material-ui/core';

export const Button = props => <MuiButton {...props } />;

I also export my own ThemeProvider which is MuiThemeProvider with a defaultTheme baked in

import { MotifThemeProvider } from 'motif';

Then In my Gatsby site I want to wrap my MotifThemeProvider and import my components (eg Button).

Right now it works but I get a flash of unstyled content, which led me to this plugin.

I have it working, but when I look under the hood it looks like the plugin itself also adds a MuiThemeProvider and that you can just pass in the theme.

I was wondering if you could explain conceptually what this plugin does, assuming that I might need to write something custom for our specific use case.

Alternatively maybe I can export my theme and pass it via the options in this plugin, but ideally I want to leverage our own ThemeProvider to try as much as possibel to consume our components.

The issue I am having is that none of my components are applying my styles, it looks like the default MUI themes

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

No branches or pull requests

1 participant