1
- import React , { memo , useEffect } from 'react' ;
2
- import Modal from 'react-modal' ;
1
+ import React , { memo } from 'react' ;
3
2
import { useDevice } from '@/hooks' ;
4
3
import { p2p } from '@deriv/api-v2' ;
5
- import { Button , Text } from '@deriv-com/ui' ;
6
- import { customStyles } from '../helpers' ;
4
+ import { Button , Modal , Text } from '@deriv-com/ui' ;
7
5
import './MyAdsDeleteModal.scss' ;
8
6
9
7
type TMyAdsDeleteModalProps = {
@@ -21,10 +19,6 @@ const MyAdsDeleteModal = ({ error, id, isModalOpen, onClickDelete, onRequestClos
21
19
22
20
const hasActiveOrders = advertInfo ?. active_orders && advertInfo ?. active_orders > 0 ;
23
21
24
- useEffect ( ( ) => {
25
- Modal . setAppElement ( '#v2_modal_root' ) ;
26
- } , [ ] ) ;
27
-
28
22
const getModalText = ( ) => {
29
23
if ( hasActiveOrders && ! error ) {
30
24
return 'You have open orders for this ad. Complete all open orders before deleting this ad.' ;
@@ -37,17 +31,22 @@ const MyAdsDeleteModal = ({ error, id, isModalOpen, onClickDelete, onRequestClos
37
31
const getModalFooter = ( ) => {
38
32
if ( hasActiveOrders || error ) {
39
33
return (
40
- < div className = 'flex justify-end' >
41
- < Button onClick = { onRequestClose } size = 'lg' textSize = { textSize } >
42
- Ok
43
- </ Button >
44
- </ div >
34
+ < Button onClick = { onRequestClose } size = 'lg' textSize = { textSize } >
35
+ Ok
36
+ </ Button >
45
37
) ;
46
38
}
47
39
48
40
return (
49
- < div className = 'flex justify-end gap-[1rem] pt-[1.6rem]' >
50
- < Button onClick = { onRequestClose } size = 'lg' textSize = { textSize } variant = 'outlined' >
41
+ < div className = 'flex gap-[0.8rem]' >
42
+ < Button
43
+ className = 'border-2'
44
+ color = 'black'
45
+ onClick = { onRequestClose }
46
+ size = 'lg'
47
+ textSize = { textSize }
48
+ variant = 'outlined'
49
+ >
51
50
Cancel
52
51
</ Button >
53
52
< Button onClick = { onClickDelete } size = 'lg' textSize = { textSize } >
@@ -60,20 +59,29 @@ const MyAdsDeleteModal = ({ error, id, isModalOpen, onClickDelete, onRequestClos
60
59
< >
61
60
{ ! isLoadingInfo && (
62
61
< Modal
63
- className = 'p-[1.6rem] p2p-v2-my-ads-delete-modal'
62
+ ariaHideApp = { false }
63
+ className = 'p2p-v2-my-ads-delete-modal'
64
64
isOpen = { isModalOpen }
65
65
onRequestClose = { onRequestClose }
66
66
shouldCloseOnOverlayClick = { false }
67
- style = { customStyles }
68
67
testId = 'dt_p2p_v2_ads_delete_modal'
69
68
>
70
- < Text as = 'div' className = 'p2p-v2-my-ads-delete-modal__header' color = 'general' weight = 'bold' >
71
- Do you want to delete this ad?
72
- </ Text >
73
- < Text as = 'div' className = 'p2p-v2-my-ads-delete-modal__body' color = 'prominent' size = 'sm' >
74
- { getModalText ( ) }
75
- </ Text >
76
- { getModalFooter ( ) }
69
+ < Modal . Header
70
+ className = 'p2p-v2-my-ads-delete-modal__header'
71
+ hideBorder
72
+ hideCloseIcon
73
+ onRequestClose = { onRequestClose }
74
+ >
75
+ < Text weight = 'bold' > Do you want to delete this ad?</ Text >
76
+ </ Modal . Header >
77
+ < Modal . Body className = 'p2p-v2-my-ads-delete-modal__body' >
78
+ < Text color = 'prominent' size = 'sm' >
79
+ { getModalText ( ) }
80
+ </ Text >
81
+ </ Modal . Body >
82
+ < Modal . Footer className = 'p2p-v2-my-ads-delete-modal__footer' hideBorder >
83
+ { getModalFooter ( ) }
84
+ </ Modal . Footer >
77
85
</ Modal >
78
86
) }
79
87
</ >
0 commit comments