@@ -12,18 +12,40 @@ import Fab from "@material-ui/core/Fab"
12
12
import AddIcon from "@material-ui/icons/Add"
13
13
import { observer } from "mobx-react-lite"
14
14
15
+ import { makeStyles } from "@material-ui/core/styles"
16
+ import Popover from "@material-ui/core/Popover"
17
+
18
+ const useStyles = makeStyles ( theme => ( {
19
+ typography : {
20
+ padding : theme . spacing ( 2 ) ,
21
+ } ,
22
+ } ) )
23
+
15
24
const ParticipantsList = observer ( ( ) => {
25
+ const classes = useStyles ( )
16
26
const rootStore = useContext ( rootStoreContext )
17
27
const participantsStore = rootStore . ParticipantStore
18
28
const [ isLoading , setIsLoading ] = useState ( false )
19
29
30
+ const [ anchorEl , setAnchorEl ] = React . useState ( null )
20
31
// useEffect is a hook that gets called after every render/re-render. Empty array second argument prevents it from running again.
21
32
useEffect ( ( ) => {
22
33
setIsLoading ( true )
23
34
participantsStore . getParticipants ( )
24
35
setIsLoading ( false )
25
36
} , [ ] )
26
37
38
+ const handleClick = event => {
39
+ setAnchorEl ( event . currentTarget )
40
+ }
41
+
42
+ const handleClose = ( ) => {
43
+ setAnchorEl ( null )
44
+ }
45
+
46
+ const open = Boolean ( anchorEl )
47
+ const id = open ? "simple-popover" : undefined
48
+
27
49
return (
28
50
< Fragment >
29
51
{ isLoading ? (
@@ -94,9 +116,38 @@ const ParticipantsList = observer(() => {
94
116
< Typography > Race</ Typography >
95
117
</ TableCell >
96
118
< TableCell >
97
- < Fab color = "primary" size = "small" aria-label = "add" >
119
+ < Fab
120
+ color = "primary"
121
+ size = "small"
122
+ aria-label = "add"
123
+ onClick = { handleClick }
124
+ >
98
125
< AddIcon />
99
126
</ Fab >
127
+ < Popover
128
+ id = { id }
129
+ open = { open }
130
+ anchorEl = { anchorEl }
131
+ onClose = { handleClose }
132
+ anchorOrigin = { {
133
+ vertical : "bottom" ,
134
+ horizontal : "center" ,
135
+ } }
136
+ transformOrigin = { {
137
+ vertical : "top" ,
138
+ horizontal : "center" ,
139
+ } }
140
+ >
141
+ < Typography className = { classes . typography } >
142
+ Step
143
+ </ Typography >
144
+ < Typography className = { classes . typography } >
145
+ Case Management
146
+ </ Typography >
147
+ < Typography className = { classes . typography } >
148
+ Legal
149
+ </ Typography >
150
+ </ Popover >
100
151
</ TableCell >
101
152
</ TableRow >
102
153
) ) }
0 commit comments