Skip to content

Commit

Permalink
Fix to support @material-ui/core ^4.14.1
Browse files Browse the repository at this point in the history
i.e. handle the deprecation of .MuiCollapse-container in the Collapse component.

The changes in ./src came from iamhosseindhv#396, the changes in the redux-example are from the lint rules.
  • Loading branch information
ggascoigne committed Jul 9, 2021
1 parent 5e1fcfa commit 927c179
Show file tree
Hide file tree
Showing 11 changed files with 42,678 additions and 21,135 deletions.
46,443 changes: 25,470 additions & 20,973 deletions examples/redux-example/package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions examples/redux-example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const App = () => {
const dispatch = useDispatch();
const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args));
const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args));
const [index, setIndex] = React.useState(0)
const [index, setIndex] = React.useState(0);

const handleClick = () => {
// NOTE:
Expand All @@ -27,15 +27,15 @@ const App = () => {
anchorOrigin: { vertical: 'top', horizontal: 'right' },
key,
variant: 'warning',
action: key => (
action: () => (
<Button onClick={() => closeSnackbar(key)}>dismiss me</Button>
),
},
});
};

const handleSequence = () => {
setIndex((i) => i+1)
setIndex((i) => i + 1);
// NOTE:
// if you want to be able to dispatch a `closeSnackbar` action later on,
// you SHOULD pass your own `key` in the options. `key` can be any sequence
Expand All @@ -47,7 +47,7 @@ const App = () => {
key: 'sequence',
variant: 'warning',
updateDuplicate: true,
action: key => (
action: (key) => (
<Button onClick={() => closeSnackbar(key)}>dismiss me</Button>
),
},
Expand All @@ -59,14 +59,14 @@ const App = () => {
};

return (
<Fragment>
<>
<Notifier />
<Typography variant="h4" gutterBottom>Notistack redux example</Typography>

<Button variant="contained" onClick={handleClick}>Display snackbar</Button>
<Button variant="contained" onClick={handleSequence}>Display sequential snackbar</Button>
<Button variant="contained" onClick={handleDismissAll}>Dismiss all snackbars</Button>
</Fragment>
</>
);
};

Expand Down
4 changes: 2 additions & 2 deletions examples/redux-example/src/Notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ let displayed = [];

const Notifier = () => {
const dispatch = useDispatch();
const notifications = useSelector(store => store.app.notifications || []);
const notifications = useSelector((store) => store.app.notifications || []);
const { enqueueSnackbar, closeSnackbar } = useSnackbar();

const storeDisplayed = (id) => {
displayed = [...displayed, id];
};

const removeDisplayed = (id) => {
displayed = [...displayed.filter(key => id !== key)];
displayed = [...displayed.filter((key) => id !== key)];
};

React.useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions examples/redux-example/src/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export const enqueueSnackbar = (notification) => {
};
};

export const closeSnackbar = key => ({
export const closeSnackbar = (key) => ({
type: CLOSE_SNACKBAR,
dismissAll: !key, // dismiss all if no key has been defined
key,
});

export const removeSnackbar = key => ({
export const removeSnackbar = (key) => ({
type: REMOVE_SNACKBAR,
key,
});
4 changes: 2 additions & 2 deletions examples/redux-example/src/redux/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default (state = defaultState, action) => {
case CLOSE_SNACKBAR:
return {
...state,
notifications: state.notifications.map(notification => (
notifications: state.notifications.map((notification) => (
(action.dismissAll || notification.key === action.key)
? { ...notification, dismissed: true }
: { ...notification }
Expand All @@ -32,7 +32,7 @@ export default (state = defaultState, action) => {
return {
...state,
notifications: state.notifications.filter(
notification => notification.key !== action.key,
(notification) => notification.key !== action.key,
),
};

Expand Down
Loading

0 comments on commit 927c179

Please sign in to comment.