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

Create type for classes in SnackbarProviderProps #36

Closed
wants to merge 1 commit into from

Conversation

sethduncan
Copy link

I had to add this type for my app to compile. Is this the best type to place here? I referenced the MUI documentation for the type.

https://material-ui.com/api/snackbar/

I had to add this type for my app to compile. Is this the best type to place here? I referenced the MUI documentation for the type.

https://material-ui.com/api/snackbar/
@martinmckenna
Copy link
Contributor

martinmckenna commented Dec 7, 2018

These could be typed better

import { SnackbarClassKey } from '@material-ui/core/Snackbar' // import the class keys
import { StyledComponentProps } from '@material-ui/core/styles'; // import classes and innerRef props

type NotistackClassKeys = 'variantSuccess'
| 'variantError'
| 'variantInfo'
| 'variantWarning';

type AllClassKeys = NotistackClassKeys & SnackbarClassKey;

interface SnackbarProviderPropsWithClasses extends StyledComponentProps<AllClassKeys>  {
    maxSnack: number;
    iconVariant?: React.ComponentType<SvgIconProps>;
    hideIconVariant?: boolean;
    onClickAction?: Function;
}

/** most likely will have to Omit the classes prop here as well */
export interface SnackbarProviderProps extends Omit<SnackbarProps, 'open'|'message'> {
}

Most of that should work. Haven't tested myself

@iamhosseindhv
Copy link
Owner

@martinmckenna That looks good. Would you be able to create a PR for that?

@iamhosseindhv iamhosseindhv mentioned this pull request Dec 8, 2018
@martinmckenna
Copy link
Contributor

@iamhosseindhv yeah I'll try to carve out some time tomorrow

@martinmckenna
Copy link
Contributor

martinmckenna commented Dec 9, 2018

@iamhosseindhv #37

This is what happens when I stay up late 🤷‍♀️

@iamhosseindhv
Copy link
Owner

iamhosseindhv commented Dec 9, 2018

well done @martinmckenna @sethduncan. update will be published in the next version.

@sethduncan sethduncan deleted the patch-1 branch December 10, 2018 13:13
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.

3 participants