1
1
import React from 'react' ;
2
- import PropTypes from 'prop-types' ;
3
2
4
3
import { gettext } from '../utils' ;
5
4
6
5
import { Modal } from './index' ;
7
6
import { ButtonList , Icon } from './UI' ;
8
7
import { KEYCODES } from '../constants' ;
9
8
10
- export class ConfirmationModal extends React . Component {
9
+ interface IProps {
10
+ handleHide ( itemType ?: string ) : void ;
11
+ modalProps : {
12
+ onCancel ?( ) : void ;
13
+ cancelText ?: string ;
14
+ ignore ?( ) : void ;
15
+ showIgnore ?: boolean ;
16
+ ignoreText ?: string ;
17
+ okText ?: string ;
18
+ action ?( ) : void ;
19
+ title ?: string ;
20
+ body : React . ReactNode ;
21
+ itemType ?: string ;
22
+ autoClose ?: boolean ;
23
+ large ?: boolean ;
24
+ bodyClassname ?: string ;
25
+ } ;
26
+ }
27
+
28
+ interface IState {
29
+ submitting : boolean ;
30
+ }
31
+
32
+ export class ConfirmationModal extends React . Component < IProps , IState > {
11
33
constructor ( props ) {
12
34
super ( props ) ;
13
35
@@ -96,14 +118,18 @@ export class ConfirmationModal extends React.Component {
96
118
}
97
119
98
120
return (
99
- < Modal show = { true } onHide = { this . onCancel } >
121
+ < Modal
122
+ show = { true }
123
+ onHide = { this . onCancel }
124
+ large = { this . props . modalProps . large }
125
+ >
100
126
< Modal . Header >
101
127
< h3 className = "modal__heading" > { modalProps . title || gettext ( 'Confirmation' ) } </ h3 >
102
128
< a className = "icn-btn" aria-label = { gettext ( 'Close' ) } onClick = { this . onCancel } >
103
129
< Icon icon = "icon-close-small" />
104
130
</ a >
105
131
</ Modal . Header >
106
- < Modal . Body >
132
+ < Modal . Body className = { this . props . modalProps . bodyClassname } >
107
133
< div >
108
134
{ modalProps . body || gettext ( 'Are you sure ?' ) }
109
135
</ div >
@@ -115,23 +141,3 @@ export class ConfirmationModal extends React.Component {
115
141
) ;
116
142
}
117
143
}
118
-
119
- ConfirmationModal . propTypes = {
120
- handleHide : PropTypes . func . isRequired ,
121
- modalProps : PropTypes . shape ( {
122
- onCancel : PropTypes . func ,
123
- cancelText : PropTypes . string ,
124
- ignore : PropTypes . func ,
125
- showIgnore : PropTypes . bool ,
126
- ignoreText : PropTypes . string ,
127
- okText : PropTypes . string ,
128
- action : PropTypes . func ,
129
- title : PropTypes . string ,
130
- body : PropTypes . oneOfType ( [
131
- PropTypes . string ,
132
- PropTypes . element ,
133
- ] ) ,
134
- itemType : PropTypes . string ,
135
- autoClose : PropTypes . bool ,
136
- } ) ,
137
- } ;
0 commit comments