1
1
import {
2
2
createStyles ,
3
- Dialog ,
4
3
DialogActions ,
5
4
DialogContent ,
6
5
Grid ,
@@ -11,6 +10,7 @@ import {
11
10
import WarningIcon from "@material-ui/icons/Warning" ;
12
11
import React , { ReactElement } from "react" ;
13
12
import Button from "../../../common/components/input/buttons/Button" ;
13
+ import AnchoredDialog from "../../../common/components/layout/dialog/AnchoredDialog" ;
14
14
import { darkTheme } from "../../../themes" ;
15
15
16
16
type PriceWarningProps = {
@@ -32,48 +32,51 @@ const PriceWarning = (props: PriceWarningProps): ReactElement => {
32
32
const { priceOffset, containerId, handleClose, onConfirmed } = props ;
33
33
const classes = useStyles ( ) ;
34
34
35
+ const content = (
36
+ < >
37
+ < DialogContent >
38
+ < Grid
39
+ item
40
+ container
41
+ spacing = { 1 }
42
+ justify = "center"
43
+ alignItems = "flex-start"
44
+ wrap = "nowrap"
45
+ >
46
+ < Grid item className = { classes . iconContainer } >
47
+ < WarningIcon fontSize = "small" />
48
+ </ Grid >
49
+ < Grid item >
50
+ < Typography variant = "body2" align = "center" >
51
+ Once executed, this order will move the market price by{ " " }
52
+ { priceOffset } %.
53
+ </ Typography >
54
+ < Typography variant = "body2" align = "center" >
55
+ Are you sure you want to go ahead?
56
+ </ Typography >
57
+ </ Grid >
58
+ </ Grid >
59
+ </ DialogContent >
60
+ < DialogActions >
61
+ < Button text = "Cancel" variant = "outlined" onClick = { handleClose } />
62
+ < Button
63
+ text = "Place Order"
64
+ variant = "contained"
65
+ color = "primary"
66
+ onClick = { onConfirmed }
67
+ />
68
+ </ DialogActions >
69
+ </ >
70
+ ) ;
71
+
35
72
return (
36
73
< ThemeProvider theme = { darkTheme } >
37
- < Dialog
74
+ < AnchoredDialog
38
75
open
39
- onClose = { handleClose }
40
- style = { { position : "absolute" } }
41
- BackdropProps = { { style : { position : "absolute" } } }
42
- container = { ( ) => document . getElementById ( containerId ) }
43
- >
44
- < DialogContent >
45
- < Grid
46
- item
47
- container
48
- spacing = { 1 }
49
- justify = "center"
50
- alignItems = "flex-start"
51
- wrap = "nowrap"
52
- >
53
- < Grid item className = { classes . iconContainer } >
54
- < WarningIcon fontSize = "small" />
55
- </ Grid >
56
- < Grid item >
57
- < Typography variant = "body2" align = "center" >
58
- Once executed, this order will move the market price by{ " " }
59
- { priceOffset } %.
60
- </ Typography >
61
- < Typography variant = "body2" align = "center" >
62
- Are you sure you want to go ahead?
63
- </ Typography >
64
- </ Grid >
65
- </ Grid >
66
- </ DialogContent >
67
- < DialogActions >
68
- < Button text = "Cancel" variant = "outlined" onClick = { handleClose } />
69
- < Button
70
- text = "Place Order"
71
- variant = "contained"
72
- color = "primary"
73
- onClick = { onConfirmed }
74
- />
75
- </ DialogActions >
76
- </ Dialog >
76
+ handleClose = { handleClose }
77
+ containerId = { containerId }
78
+ content = { content }
79
+ />
77
80
</ ThemeProvider >
78
81
) ;
79
82
} ;
0 commit comments