AddButton.js
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React, { useState } from "react";
import { makeStyles } from "@material-ui/core/styles";
import ModalControl from "./ModalControl.js";
import Icon from "@material-ui/core/Icon";
import IconButton from "@material-ui/core/IconButton";
const useStyles = makeStyles((theme) => ({
iconButton: {
margin: "0",
padding: "0",
position: "fixed",
bottom: "3rem",
right: "3rem",
},
icon: {
fontSize: 70,
color: "black",
},
addButton: {
fontSize: 11,
float: "right",
margin: 0,
marginTop: "1rem",
marginRight: "1rem",
},
buttonGroup: {
clear: "both",
"& > *": {
margin: theme.spacing(1),
float: "right",
},
},
}));
export default function AddButton() {
const classes = useStyles();
const [open, setOpen] = useState(false);
const handleOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
if (!open) {
return (
<>
<IconButton className={classes.iconButton} onClick={handleOpen}>
<Icon className={classes.icon}>add_circle</Icon>
</IconButton>
</>
);
} else {
return (
<>
<ModalControl handleClose={handleClose} />
</>
);
}
}