Created SnackBar
Co-authored-by: SgtPodding <SgtPodding@users.noreply.github.com>
This commit is contained in:
parent
cd6d00279e
commit
6be3966bab
|
@ -0,0 +1,29 @@
|
|||
import * as React from 'react';
|
||||
import Stack from '@mui/material/Stack';
|
||||
import Button from '@mui/material/Button';
|
||||
import Snackbar from '@mui/material/Snackbar';
|
||||
import MuiAlert from '@mui/material/Alert';
|
||||
|
||||
const Alert = React.forwardRef(function Alert(props, ref) {
|
||||
return <MuiAlert elevation={6} ref={ref} variant="filled" {...props} />;
|
||||
});
|
||||
|
||||
export default function showError(props) {
|
||||
const handleClose = (event, reason) => {
|
||||
if (reason === 'clickaway') {
|
||||
return;
|
||||
}
|
||||
|
||||
props.setOpen(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack spacing={2} sx={{ width: '100%' }}>
|
||||
<Snackbar open={props.open} autoHideDuration={6000} onClose={handleClose}>
|
||||
<Alert onClose={handleClose} severity="error" sx={{ width: '100%' }}>
|
||||
{props.message}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
</Stack>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue