-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add snackbar global component * fix issue on onchain platform * remove import
- Loading branch information
1 parent
a6de7cc
commit 4c3baa1
Showing
9 changed files
with
341 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Snackbar, Alert } from '@mui/material'; | ||
|
||
import useSnackbarStore from '../../store/useSnackbarStore'; | ||
|
||
/** | ||
* CustomSnackbar component displays a Snackbar using Material-UI's Snackbar component. | ||
* It uses Zustand store for managing Snackbar state globally. | ||
* | ||
* @returns {JSX.Element} The rendered CustomSnackbar component. | ||
*/ | ||
export const CustomSnackbar = (): JSX.Element => { | ||
const { message, open, options, closeSnackbar } = useSnackbarStore(); | ||
|
||
return ( | ||
<Snackbar | ||
anchorOrigin={ | ||
options?.position || { vertical: 'bottom', horizontal: 'right' } | ||
} | ||
autoHideDuration={options?.duration} | ||
open={open} | ||
onClose={closeSnackbar} | ||
> | ||
<Alert | ||
severity={options?.severity || 'info'} | ||
sx={{ width: '100%' }} | ||
variant="filled" | ||
onClose={closeSnackbar} | ||
> | ||
{message} | ||
</Alert> | ||
</Snackbar> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.