SettingButton.js
1.05 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
import React, { useState } from "react";
import ModifyControl from "./ModifyControl.js";
import { makeStyles } from "@material-ui/core/styles";
import Icon from "@material-ui/core/Icon";
import IconButton from "@material-ui/core/IconButton";
const useStyles = makeStyles({
iconButton: {
float: "right",
margin: "0",
padding: "0",
},
icon: {
fontSize: 16,
color: "gray",
},
});
export default function SettingButton({data, isMine }) {
const classes = useStyles();
const [open, setOpen] = useState();
const handleOpen = () => {
setOpen(true);
console.log(data);
};
const handleClose = () => {
setOpen(false);
};
if (isMine) {
if (!open) {
return (
<>
<IconButton className={classes.iconButton} onClick={handleOpen}>
<Icon className={classes.icon}>settings</Icon>
</IconButton>
</>
);
} else {
return (
<>
<ModifyControl handleClose={handleClose} data={data}/>
</>
);
}
} else {
return <></>;
}
}