@@ -33,16 +33,18 @@ export const ErrorBanner = (props) => {
33
33
{ copyButtonText }
34
34
</ Button >
35
35
) }
36
- < Button
37
- className = { classes . errorButton }
38
- size = "small"
39
- color = "inherit"
40
- variant = "outlined"
41
- data-cy = "dismiss-error-button"
42
- onClick = { clearErrors }
43
- >
44
- { labels . dismissButtonText }
45
- </ Button >
36
+ { clearErrors && (
37
+ < Button
38
+ className = { classes . errorButton }
39
+ size = "small"
40
+ color = "inherit"
41
+ variant = "outlined"
42
+ data-cy = "dismiss-error-button"
43
+ onClick = { clearErrors }
44
+ >
45
+ { labels . dismissButtonText }
46
+ </ Button >
47
+ ) }
46
48
</ div >
47
49
</ Paper >
48
50
</ Slide >
@@ -51,19 +53,20 @@ export const ErrorBanner = (props) => {
51
53
52
54
ErrorBanner . propTypes = {
53
55
error : PropTypes . object . isRequired ,
54
- clearErrors : PropTypes . func . isRequired ,
56
+ clearErrors : PropTypes . func ,
55
57
labels : PropTypes . shape ( {
56
58
tooLongErrorMessage : PropTypes . string ,
57
- dismissButtonText : PropTypes . string . isRequired ,
59
+ dismissButtonText : PropTypes . string ,
58
60
secondButtonText : PropTypes . string . isRequired ,
59
61
toggledButtonText : PropTypes . string ,
60
62
} ) ,
61
63
} ;
62
64
ErrorBanner . defaultProps = {
63
65
labels : {
66
+ dismissButtonText : 'Dismiss' ,
64
67
tooLongErrorMessage :
65
- // eslint-disable-next-line max-len
66
- 'Detailed error message is too long to be displayed. To read it, please use the COPY button and paste it in your favorite text editor.' ,
68
+ 'Detailed error message is too long to be displayed. To read it, please use the COPY button and paste it in ' +
69
+ 'your favorite text editor.' ,
67
70
toggledButtonText : 'Copied' ,
68
71
} ,
69
72
} ;
0 commit comments