all repos — caroster @ 8a4f9e069b406ad3b9c2405dbef767b2a5304477

[Octree] Group carpool to your event https://caroster.io

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;