You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
import React from 'react';
|
|
import Snackbar from '@material-ui/core/Snackbar';
|
|
import {Image} from "react-bootstrap";
|
|
import MuiAlert, {AlertProps} from '@material-ui/lab/Alert';
|
|
|
|
function Alert(props: AlertProps) {
|
|
return <MuiAlert elevation={6} variant="filled" {...props} />;
|
|
}
|
|
|
|
export function SimpleSnackbar(props:Readonly<{message:string;duration:number;onClose:Function }>) {
|
|
|
|
|
|
const [open, setOpen] = React.useState(true);
|
|
|
|
const handleClose = (event: React.SyntheticEvent | React.MouseEvent, reason?: string) => {
|
|
if (reason === 'clickaway') {
|
|
return;
|
|
}
|
|
|
|
setOpen(false);
|
|
|
|
props.onClose()
|
|
};
|
|
|
|
return (
|
|
<Snackbar
|
|
open={open}
|
|
autoHideDuration={props.duration}
|
|
onClose={handleClose}
|
|
action={
|
|
<React.Fragment>
|
|
<Image className="closeIcon20" src="close.svg" onClick={handleClose}/>
|
|
</React.Fragment>
|
|
}
|
|
>
|
|
<Alert severity="success" onClick={handleClose}>
|
|
{props.message}
|
|
</Alert>
|
|
</Snackbar>
|
|
);
|
|
}
|
|
|