Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
import * as React from 'react';
|
|
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 SimpleSnackbar() {
|
|
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 (
|
|
<div>
|
|
<Button onClick={handleClick}>Open Snackbar</Button>
|
|
<Snackbar
|
|
open={open}
|
|
autoHideDuration={6000}
|
|
onClose={handleClose}
|
|
message="Note archived"
|
|
action={action}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|