This repository was archived by the owner on Mar 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.jsx
76 lines (66 loc) · 1.71 KB
/
index.jsx
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
/**
* This component will show a modal window detailing an error.
* It is displayed by calling fireErrorMessage from utils/errors and should not
* be used directly.
*/
/* eslint-env browser */
import React from 'react';
import PT from 'prop-types';
import { DangerButton } from 'components/buttons';
import { Modal } from 'topcoder-react-utils';
import style from './style.scss';
class ErrorMessage extends React.Component {
componentDidMount() {
document.body.classList.add('scrolling-disabled-by-modal');
}
componentWillUnmount() {
document.body.classList.remove('scrolling-disabled-by-modal');
}
render() {
const {
title,
details,
support,
onOk,
} = this.props;
return (
<Modal theme={{ container: style.container }}>
<p styleName="title">{title}</p>
<p styleName="details">{details}</p>
{
support ? (
<p styleName="details">
{support}
</p>
) : (
<p styleName="details">
We are sorry that you have encountered this problem. Please, contact
our support ‌
<a href="mailto:[email protected]">[email protected]</a>
‌ to help us resolve it as soon as possible.
</p>
)
}
<DangerButton
onClick={(e) => {
e.preventDefault();
onOk();
}}
>
OK
</DangerButton>
</Modal>
);
}
}
ErrorMessage.defaultProps = {
details: '',
support: '',
};
ErrorMessage.propTypes = {
title: PT.string.isRequired,
details: PT.string,
support: PT.string,
onOk: PT.func.isRequired,
};
export default ErrorMessage;