36 lines
676 B
JavaScript
36 lines
676 B
JavaScript
"use client";
|
|
|
|
import { Alert, Snackbar } from "@mui/material";
|
|
import { useState } from "react";
|
|
|
|
function AlertMsg() {
|
|
const [open, setOpen] = useState(true);
|
|
|
|
const handleClick = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleClose = (event, reason) => {
|
|
if (reason === "clickaway") {
|
|
return;
|
|
}
|
|
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<Snackbar open={open} autoHideDuration={6000} onClose={handleClose}>
|
|
<Alert
|
|
onClose={handleClose}
|
|
severity="success"
|
|
variant="filled"
|
|
sx={{ width: "100%" }}
|
|
>
|
|
This is a success Alert inside a Snackbar!
|
|
</Alert>
|
|
</Snackbar>
|
|
);
|
|
}
|
|
|
|
export default AlertMsg;
|