-
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.
- Loading branch information
1 parent
2ddf725
commit 55cb65e
Showing
6 changed files
with
126 additions
and
25 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,43 @@ | ||
import { Button, IconButton, Snackbar, Fade } from "@mui/material"; | ||
import { Close as CloseIcon } from "@mui/icons-material"; | ||
|
||
const TaskSnackBar = ({ isOpen, onClose, onUndo }) => { | ||
const handleClose = (event, reason) => { | ||
if (reason === "clickaway") { | ||
return; | ||
} | ||
onClose(); | ||
}; | ||
|
||
const handleUndoClick = () => { | ||
onUndo(); | ||
handleClose(); | ||
}; | ||
|
||
const action = ( | ||
<> | ||
<Button color="error" size="small" onClick={handleUndoClick}> | ||
Desfazer | ||
</Button> | ||
<IconButton size="small" color="inherit" onClick={handleClose}> | ||
<CloseIcon fontSize="small" /> | ||
</IconButton> | ||
</> | ||
); | ||
|
||
return ( | ||
<Snackbar | ||
open={isOpen} | ||
autoHideDuration={6000} | ||
onClose={handleClose} | ||
message="1 tarefa concluída!" | ||
action={action} | ||
anchorOrigin={{ vertical: "bottom", horizontal: "center" }} | ||
TransitionComponent={Fade} | ||
key={Fade.name} | ||
sx={{ "& .MuiPaper-root": { color: "black", backgroundColor: "white" } }} | ||
/> | ||
); | ||
}; | ||
|
||
export default TaskSnackBar; |
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,3 @@ | ||
import TaskSnackBar from "./TaskSnackBar"; | ||
|
||
export default TaskSnackBar; |
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