-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simple snakbar. fix login issues
- Loading branch information
Showing
3 changed files
with
88 additions
and
57 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,44 @@ | ||
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({ message = "Default message" }) { | ||
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={message} | ||
action={action} | ||
/> | ||
</div> | ||
); | ||
} |