Skip to content

Commit

Permalink
Fixes #373 - Remove collapse customisation
Browse files Browse the repository at this point in the history
  • Loading branch information
iamhosseindhv committed May 8, 2021
1 parent f42da42 commit beab947
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
26 changes: 2 additions & 24 deletions src/SnackbarItem/SnackbarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import clsx from 'clsx';
import { withStyles, WithStyles, createStyles, Theme, emphasize } from '@material-ui/core/styles';
import Collapse from '@material-ui/core/Collapse';
import SnackbarContent from '../SnackbarContent';
import { getTransitionDirection, omitNonCollapseKeys } from './SnackbarItem.util';
import { allClasses, REASONS, SNACKBAR_INDENTS, objectMerge, DEFAULTS, transformer } from '../utils/constants';
import { getTransitionDirection } from './SnackbarItem.util';
import { allClasses, REASONS, objectMerge, DEFAULTS, transformer } from '../utils/constants';
import { SharedProps, RequiredBy, TransitionHandlerProps, SnackbarProviderProps as ProviderProps } from '../index';
import defaultIconVariants from '../utils/defaultIconVariants';
import createChainedFunction from '../utils/createChainedFunction';
Expand Down Expand Up @@ -65,27 +65,6 @@ const styles = (theme: Theme) => {
bottom: 0,
left: 0,
},
collapseContainer: {
[theme.breakpoints.down('xs')]: {
paddingLeft: theme.spacing(1),
paddingRight: theme.spacing(1),
},
},
collapseWrapper: {
transition: theme.transitions.create(['margin-bottom'], { easing: 'ease' }),
marginTop: SNACKBAR_INDENTS.snackbar.default,
marginBottom: SNACKBAR_INDENTS.snackbar.default,
},
collapseWrapperDense: {
marginTop: SNACKBAR_INDENTS.snackbar.dense,
marginBottom: SNACKBAR_INDENTS.snackbar.dense,
},
collapseWrapperInner: {
width: 'auto',
[theme.breakpoints.down('xs')]: {
width: '100%',
},
},
});
}

Expand Down Expand Up @@ -214,7 +193,6 @@ const SnackbarItem: React.FC<SnackbarItemProps> = ({ classes, ...props }) => {
unmountOnExit
timeout={175}
in={collapsed}
classes={omitNonCollapseKeys(classes, dense)}
onExited={callbacks.onExited}
>
{/* @ts-ignore */}
Expand Down
12 changes: 0 additions & 12 deletions src/SnackbarItem/SnackbarItem.util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import clsx from 'clsx';
import { SnackbarItemProps } from './SnackbarItem';
import { Snack } from '../SnackbarProvider';
import { SnackbarProviderProps } from '..';

const DIRECTION = {
right: 'left',
Expand All @@ -17,12 +14,3 @@ export const getTransitionDirection = (anchorOrigin: Snack['anchorOrigin']): Dir
}
return DIRECTION[anchorOrigin.vertical];
};

/**
* Omit all class keys except what we need for collapse component
*/
export const omitNonCollapseKeys = (classes: SnackbarItemProps['classes'], dense: SnackbarProviderProps['dense']): { container: string; wrapper: string; wrapperInner: string; } => ({
container: classes.collapseContainer,
wrapper: clsx(classes.collapseWrapper, { [classes.collapseWrapperDense]: dense }),
wrapperInner: classes.collapseWrapperInner,
});

0 comments on commit beab947

Please sign in to comment.