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

Is there a way to customize font-size and line-height? #44

Closed
ghost opened this issue Jan 6, 2019 · 5 comments
Closed

Is there a way to customize font-size and line-height? #44

ghost opened this issue Jan 6, 2019 · 5 comments

Comments

@ghost
Copy link

ghost commented Jan 6, 2019

Hi @iamhosseindhv!

Great job! I use notistack quite often but I have a question. How can I customize font-size and line-height properties on SnackbarItem component? It seems like they are hardcoded:
https://github.com/iamhosseindhv/notistack/blob/master/src/SnackbarItem/SnackbarItem.styles.js#L10

Thanks in advance!

@iamhosseindhv
Copy link
Owner

@czelusniakdawid You can do so by overriding classes. see material-ui docs for more info.

example: https://codesandbox.io/s/3qr4owqnmq

const styles = {
  base: {
    fontSize: 33,
  },
};

const App = ({ classes }) => (
    <SnackbarProvider
      maxSnack={3}
      classes={{
        base: classes.base,
      }}
    >
        <MessageButtons />
    </SnackbarProvider>
);

@elitan
Copy link

elitan commented Mar 14, 2019

Is there a way to do this on the SnackbarProvider-component directly?

Something like:

    <SnackbarProvider
      maxSnack={3}
      classes={{
        base: { fontSize: 33 }
      }}
    >

@iamhosseindhv
Copy link
Owner

iamhosseindhv commented Mar 14, 2019

@elitan Classes prop only accepts string values (i.e. name of the class) and not objects.

@elitan
Copy link

elitan commented Mar 14, 2019

@elitan Classes prop only accepts string values (i.e. name of the class) and not objects.

I am not sure how that relates to my question.

@iamhosseindhv
Copy link
Owner

Meaning that value for the key base (in your example), must be a string, while you are passing an object.

<SnackbarProvider
      maxSnack={3}
      classes={{
        base: { fontSize: 33 } // <-- object ❌
        base: 'name-of-the-class' // <-- string ✅
      }}
    >

code example: https://codesandbox.io/s/2014qr4vvn

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

2 participants