78 lines
1.7 KiB
JavaScript
78 lines
1.7 KiB
JavaScript
import React from "react";
|
|
import Card from "@mui/material/Card";
|
|
import { Typography } from "@mui/material";
|
|
import Button from '@mui/material/Button';
|
|
import Snackbar from '@mui/material/Snackbar';
|
|
import IconButton from '@mui/material/IconButton';
|
|
import CloseIcon from '@mui/icons-material/Close';
|
|
|
|
export default function SimpleSnackbars() {
|
|
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
const handleClick = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleClose = (event, reason) => {
|
|
if (reason === 'clickaway') {
|
|
return;
|
|
}
|
|
|
|
setOpen(false);
|
|
};
|
|
|
|
const action = (
|
|
<React.Fragment>
|
|
<Button color="secondary" size="small" onClick={handleClose}>
|
|
UNDO
|
|
</Button>
|
|
<IconButton
|
|
size="small"
|
|
aria-label="close"
|
|
color="inherit"
|
|
onClick={handleClose}
|
|
>
|
|
<CloseIcon fontSize="small" />
|
|
</IconButton>
|
|
</React.Fragment>
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<Card
|
|
sx={{
|
|
boxShadow: "none",
|
|
borderRadius: "10px",
|
|
p: "25px",
|
|
mb: "15px",
|
|
}}
|
|
>
|
|
<Typography
|
|
as="h3"
|
|
sx={{
|
|
fontSize: 18,
|
|
fontWeight: 500,
|
|
mb: '15px'
|
|
}}
|
|
>
|
|
Simple Snackbars
|
|
</Typography>
|
|
|
|
<>
|
|
<Button onClick={handleClick} variant="contained" color="primary" size="large" className="whiteColor">
|
|
Open simple snackbar
|
|
</Button>
|
|
<Snackbar
|
|
open={open}
|
|
autoHideDuration={5000}
|
|
onClose={handleClose}
|
|
message="Note archived"
|
|
action={action}
|
|
/>
|
|
</>
|
|
</Card>
|
|
</>
|
|
);
|
|
}
|