Skip to content

Commit

Permalink
[snackbar] Improve styles (mui#25737)
Browse files Browse the repository at this point in the history
  • Loading branch information
MieleVL committed Apr 12, 2021
1 parent 9e097a5 commit f35c635
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions packages/material-ui/src/Snackbar/Snackbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ const SnackbarRoot = experimentalStyled(
overridesResolver,
},
)(({ theme, styleProps }) => {
const top1 = { top: 8 };
const bottom1 = { bottom: 8 };
const right = { justifyContent: 'flex-end' };
const left = { justifyContent: 'flex-start' };
const top3 = { top: 24 };
const bottom3 = { bottom: 24 };
const right3 = { right: 24 };
const left3 = { left: 24 };
const center = {
left: '50%',
right: 'auto',
Expand All @@ -68,18 +60,16 @@ const SnackbarRoot = experimentalStyled(
zIndex: theme.zIndex.snackbar,
position: 'fixed',
display: 'flex',
left: 8,
right: 8,
justifyContent: 'center',
alignItems: 'center',
...(styleProps.anchorOrigin.vertical === 'top' ? top1 : bottom1),
...(styleProps.anchorOrigin.horizontal === 'left' && left),
...(styleProps.anchorOrigin.horizontal === 'right' && right),
...(styleProps.anchorOrigin.vertical === 'top' ? { top: 8 } : { bottom: 8 }),
...(styleProps.anchorOrigin.horizontal === 'left' && { justifyContent: 'flex-start', left: 8 }),
...(styleProps.anchorOrigin.horizontal === 'right' && { justifyContent: 'flex-end', right: 8 }),
[theme.breakpoints.up('sm')]: {
...(styleProps.anchorOrigin.vertical === 'top' ? top3 : bottom3),
...(styleProps.anchorOrigin.vertical === 'top' ? { top: 24 } : { bottom: 24 }),
...(styleProps.anchorOrigin.horizontal === 'center' && center),
...(styleProps.anchorOrigin.horizontal === 'left' && left3),
...(styleProps.anchorOrigin.horizontal === 'right' && right3),
...(styleProps.anchorOrigin.horizontal === 'left' && { left: 24 }),
...(styleProps.anchorOrigin.horizontal === 'right' && { right: 24 })
},
};
});
Expand Down

0 comments on commit f35c635

Please sign in to comment.