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 427 #429

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions src/SnackbarItem/SnackbarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const classes = {
};

const StyledSnackbar = styled(Snackbar)(({ theme }) => {
const mode = theme.palette.mode || theme.palette.type;
const backgroundColor = emphasize(theme.palette.background.default, mode === 'light' ? 0.8 : 0.98);
const mode = theme.palette.mode;

return {
[`&.${classes.wrappedRoot}`]: {
Expand All @@ -41,43 +40,43 @@ const StyledSnackbar = styled(Snackbar)(({ theme }) => {
},
[`.${classes.contentRoot}`]: {
...theme.typography.body2,
backgroundColor,
color: theme.palette.getContrastText(backgroundColor),
backgroundColor: emphasize(theme.palette.background.default, mode === 'light' ? 0.8 : 0.98),
color: theme.palette.getContrastText(emphasize(theme.palette.background.default, mode === 'light' ? 0.8 : 0.98)),
alignItems: 'center',
padding: '6px 16px',
padding: `${theme.spacing(0.75)} ${theme.spacing(2)}`,
borderRadius: '4px',
boxShadow: '0px 3px 5px -1px rgba(0,0,0,0.2),0px 6px 10px 0px rgba(0,0,0,0.14),0px 1px 18px 0px rgba(0,0,0,0.12)',
},
[`.${classes.lessPadding}`]: {
paddingLeft: 8 * 2.5,
paddingLeft: theme.spacing(2.5),
},
[`.${classes.variantSuccess}`]: {
backgroundColor: '#43a047', // green
color: '#fff',
backgroundColor: mode === "light" ? theme.palette.success.main : theme.palette.success.dark,
color: mode === "light" ? theme.palette.getContrastText(theme.palette.success.main) : theme.palette.getContrastText(theme.palette.success.dark),
},
[`.${classes.variantError}`]: {
backgroundColor: '#d32f2f', // dark red
color: '#fff',
backgroundColor: mode === "light" ? theme.palette.error.main : theme.palette.error.dark,
color: mode === "light" ? theme.palette.getContrastText(theme.palette.error.main) : theme.palette.getContrastText(theme.palette.error.dark),
},
[`.${classes.variantInfo}`]: {
backgroundColor: '#2196f3', // nice blue
color: '#fff',
backgroundColor: mode === "light" ? theme.palette.info.main : theme.palette.info.dark,
color: mode === "light" ? theme.palette.getContrastText(theme.palette.info.main) : theme.palette.getContrastText(theme.palette.info.dark),
},
[`.${classes.variantWarning}`]: {
backgroundColor: '#ff9800', // amber
color: '#fff',
backgroundColor: mode === "light" ? theme.palette.warning.main : theme.palette.warning.dark,
color: mode === "light" ? theme.palette.getContrastText(theme.palette.warning.main) : theme.palette.getContrastText(theme.palette.warning.dark),
},
[`.${classes.message}`]: {
display: 'flex',
alignItems: 'center',
padding: '8px 0',
padding: `${theme.spacing(1)} 0`,
},
[`.${classes.action}`]: {
display: 'flex',
alignItems: 'center',
marginLeft: 'auto',
paddingLeft: 16,
marginRight: -8,
paddingLeft: theme.spacing(2),
marginRight: theme.spacing(-1),
},
};
});
Expand Down