frontend/components/Toasts/index.tsx (view raw)
1import Snackbar from '@mui/material/Snackbar';
2import useToastStore from '../../stores/useToastStore';
3import theme from '../../theme';
4
5const Toasts = () => {
6 const toast = useToastStore(s => s.toast);
7 const action = useToastStore(s => s.action);
8 const clearToast = useToastStore(s => s.clearToast);
9
10 return (
11 <Snackbar
12 sx={{bottom: theme.spacing(8)}}
13 anchorOrigin={{
14 vertical: 'bottom',
15 horizontal: 'left',
16 }}
17 autoHideDuration={6000}
18 open={!!toast}
19 message={toast}
20 onClose={clearToast}
21 action={action}
22 />
23 );
24};
25
26export default Toasts;