Skip to content

Commit dcd2255

Browse files
author
Chris Medykiewicz
committed
US83-adding-dropdown-functionality
1 parent d8a77ab commit dcd2255

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

frontend/src/components/ParticipantsList.js

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,40 @@ import Fab from "@material-ui/core/Fab"
1212
import AddIcon from "@material-ui/icons/Add"
1313
import { observer } from "mobx-react-lite"
1414

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+
1524
const ParticipantsList = observer(() => {
25+
const classes = useStyles()
1626
const rootStore = useContext(rootStoreContext)
1727
const participantsStore = rootStore.ParticipantStore
1828
const [isLoading, setIsLoading] = useState(false)
1929

30+
const [anchorEl, setAnchorEl] = React.useState(null)
2031
// useEffect is a hook that gets called after every render/re-render. Empty array second argument prevents it from running again.
2132
useEffect(() => {
2233
setIsLoading(true)
2334
participantsStore.getParticipants()
2435
setIsLoading(false)
2536
}, [])
2637

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+
2749
return (
2850
<Fragment>
2951
{isLoading ? (
@@ -94,9 +116,38 @@ const ParticipantsList = observer(() => {
94116
<Typography>Race</Typography>
95117
</TableCell>
96118
<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+
>
98125
<AddIcon />
99126
</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>
100151
</TableCell>
101152
</TableRow>
102153
))}

0 commit comments

Comments
 (0)