[ ADD ] react configuration

This commit is contained in:
Kuroi488
2020-11-16 17:14:34 +01:00
parent 89c9cfe099
commit 5078a1a96e
71 changed files with 16891 additions and 0 deletions

View File

@ -0,0 +1,33 @@
import React from "react";
import Snackbar from "@material-ui/core/Snackbar";
import MuiAlert from "@material-ui/lab/Alert";
import { useSelector, useDispatch } from "react-redux";
import { hideSnackbarAction } from "../../store/Snackbar/SnackbarAction";
function Alert(props) {
return <MuiAlert elevation={6} variant="filled" {...props} />;
}
export function MaterialSnackbar(props) {
const { isOpen, message, type } = useSelector(state => state.snackbar);
const dispatch = useDispatch();
const handleClose = (event, reason) => {
if (reason === "clickaway") {
return;
}
dispatch(hideSnackbarAction());
};
return (
<Snackbar
open={isOpen}
autoHideDuration={4000}
anchorOrigin={{ vertical: "bottom", horizontal: "center" }}
key={`bottom,center`}
onClose={() => handleClose}
>
<Alert onClose={handleClose} severity={type} className="medium_font">
{message}
</Alert>
</Snackbar>
);
}