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