-
Notifications
You must be signed in to change notification settings - Fork 295
/
ConfirmationDialog.tsx
86 lines (78 loc) · 2.45 KB
/
ConfirmationDialog.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// @flow
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import classnames from 'classnames';
import { defineMessages, intlShape } from 'react-intl';
import Dialog from '../../../widgets/Dialog';
import styles from './ConfirmationDialog.scss';
const messages = defineMessages({
headline: {
id: 'wallet.restore.dialog.confirmation.headline',
defaultMessage: '!!!Are you sure?',
description:
'Headline for the wallet restoration cancellation confirmation dialog.',
},
content: {
id: 'wallet.restore.dialog.confirmation.content',
defaultMessage:
'!!!You haven’t submitted this information yet. If you close the window now, you will lose your progress and have to start again.',
description:
'Content for the wallet restoration cancellation confirmation dialog.',
},
cancelButtonLabel: {
id: 'wallet.restore.dialog.confirmation.button.cancelButtonLabel',
defaultMessage: '!!!Back to wallet restoration',
description:
'"Cancel" button label for the wallet restoration cancellation confirmation dialog.',
},
confirmButtonLabel: {
id: 'wallet.restore.dialog.confirmation.button.confirmButtonLabel',
defaultMessage: '!!!Close window',
description:
'"Abort" button label for the wallet restoration cancellation confirmation dialog.',
},
});
type Props = {
onConfirm: Function,
onCancel: Function,
};
@observer
export default class ConfirmationDialog extends Component<Props> {
static contextTypes = {
intl: intlShape.isRequired,
};
render() {
const { intl } = this.context;
const { onConfirm, onCancel } = this.props;
const dialogClasses = classnames([styles.component, 'ConfirmDialog']);
const confirmButtonClasses = classnames([
'confirmButton',
// 'attention',
styles.confirmButton,
]);
const actions = [
{
className: 'cancelButton',
label: intl.formatMessage(messages.cancelButtonLabel),
onClick: onCancel,
},
{
className: confirmButtonClasses,
label: intl.formatMessage(messages.confirmButtonLabel),
primary: true,
onClick: onConfirm,
},
];
return (
<Dialog
className={dialogClasses}
title={intl.formatMessage(messages.headline)}
actions={actions}
closeOnOverlayClick={false}
onClose={onCancel}
>
<p>{intl.formatMessage(messages.content)}</p>
</Dialog>
);
}
}