Skip to content

Commit a138d3e

Browse files
committed
material-ui-popup-state added
1 parent a10f584 commit a138d3e

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

package-lock.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@testing-library/react": "^9.5.0",
1111
"@testing-library/user-event": "^7.2.1",
1212
"konva": "^4.2.2",
13+
"material-ui-popup-state": "^1.6.1",
1314
"qs": "^6.9.4",
1415
"react": "^16.13.1",
1516
"react-debounce-input": "^3.2.2",

src/components/CommentsPopper.tsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from "react";
2+
import {
3+
Button,
4+
Popper,
5+
Fade,
6+
Paper,
7+
Typography,
8+
Box,
9+
makeStyles,
10+
} from "@material-ui/core";
11+
import {
12+
usePopupState,
13+
bindToggle,
14+
bindPopper,
15+
} from "material-ui-popup-state/hooks";
16+
17+
const useStyles = makeStyles((theme) => ({
18+
popperContainer: {
19+
zIndex: 1400,
20+
},
21+
}));
22+
23+
export const CommentsPopper = () => {
24+
const classes = useStyles();
25+
const popupState = usePopupState({
26+
variant: "popper",
27+
popupId: "demoPopper",
28+
});
29+
return (
30+
<React.Fragment>
31+
<Button color="primary" {...bindToggle(popupState)}>
32+
Comments
33+
</Button>
34+
<Popper
35+
{...bindPopper(popupState)}
36+
transition
37+
className={classes.popperContainer}
38+
>
39+
{({ TransitionProps }) => (
40+
<Fade {...TransitionProps} timeout={350}>
41+
<Paper>
42+
<Typography>The content of the Popper.</Typography>
43+
</Paper>
44+
</Fade>
45+
)}
46+
</Popper>
47+
</React.Fragment>
48+
);
49+
};

src/components/TestDetailsModal.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import useImage from "use-image";
3737
import { routes } from "../constants";
3838
import { useTestRunDispatch, updateTestRun, selectTestRun } from "../contexts";
3939
import { DrawArea } from "./DrawArea";
40+
import { CommentsPopper } from "./CommentsPopper";
4041

4142
const useStyles = makeStyles((theme) => ({
4243
imageContainer: {
@@ -202,6 +203,9 @@ const TestDetailsModal: React.FunctionComponent<{
202203
Baseline history
203204
</Button>
204205
</Grid>
206+
<Grid item>
207+
<CommentsPopper />
208+
</Grid>
205209
<Grid item>
206210
<Paper variant="outlined">
207211
<Grid container justify="center">

0 commit comments

Comments
 (0)