convert game saved to snackbar, index.html is nearly empty now

This commit is contained in:
Olivier Gagnon
2021-09-25 14:10:32 -04:00
parent d49fea4cbc
commit 97624395c1
4 changed files with 33 additions and 7 deletions
+29
View File
@@ -0,0 +1,29 @@
import React, { useState, useEffect } from "react";
import { Snackbar as S } from "@mui/material";
import { EventEmitter } from "../../utils/EventEmitter";
import Typography from "@mui/material/Typography";
import Paper from "@mui/material/Paper";
export const GameSavedEvents = new EventEmitter<[]>();
export function Snackbar(): React.ReactElement {
const [open, setOpen] = useState(false);
useEffect(() => GameSavedEvents.subscribe(() => setOpen(true)));
return (
<S
open={open}
anchorOrigin={{
vertical: "top",
horizontal: "center",
}}
autoHideDuration={2000}
onClose={() => setOpen(false)}
>
<Paper sx={{ p: 2 }}>
<Typography>Game Saved!</Typography>
</Paper>
</S>
);
}