15
15
*/
16
16
17
17
import { ComponentSizeType } from '@Shared/constants'
18
+ import { Progressing } from '@Common/Progressing'
18
19
import { ReactComponent as ErrorIcon } from '../../../Assets/Icon/ic-error-exclamation.svg'
19
20
import { ReactComponent as ICInfoOutline } from '../../../Assets/Icon/ic-info-outline.svg'
20
21
import { Button , ButtonVariantType } from '../Button'
@@ -29,33 +30,45 @@ const GenericSectionErrorState = ({
29
30
buttonText = 'Reload' ,
30
31
rootClassName,
31
32
useInfoIcon = false ,
32
- } : GenericSectionErrorStateProps ) => (
33
- < div className = { `flex column dc__gap-8 p-16 ${ withBorder ? 'dc__border br-4' : '' } ${ rootClassName || '' } ` } >
34
- { useInfoIcon ? (
35
- < ICInfoOutline className = "icon-dim-24" />
36
- ) : (
37
- < ErrorIcon className = "icon-dim-24 alert-icon-r5-imp" />
38
- ) }
39
- < div className = "flex column dc__gap-4 dc__align-center" >
40
- < h3 className = "fs-13 lh-20 fw-6 cn-9 m-0" > { title } </ h3 >
41
- { ( subTitle || description ) && (
42
- < div className = "flex column fs-13 lh-20 fw-4 cn-7" >
43
- { subTitle && < p className = "m-0" > { subTitle } </ p > }
44
- { description && < p className = "m-0" > { description } </ p > }
45
- </ div >
33
+ progressingProps,
34
+ } : GenericSectionErrorStateProps ) => {
35
+ const renderMarker = ( ) => {
36
+ if ( progressingProps ) {
37
+ return < Progressing { ...progressingProps } />
38
+ }
39
+
40
+ if ( useInfoIcon ) {
41
+ return < ICInfoOutline className = "icon-dim-24" />
42
+ }
43
+
44
+ return < ErrorIcon className = "icon-dim-24 alert-icon-r5-imp" />
45
+ }
46
+
47
+ return (
48
+ < div className = { `flex column dc__gap-8 p-16 ${ withBorder ? 'dc__border br-4' : '' } ${ rootClassName || '' } ` } >
49
+ { renderMarker ( ) }
50
+
51
+ < div className = "flex column dc__gap-4 dc__align-center" >
52
+ < h3 className = "fs-13 lh-20 fw-6 cn-9 m-0" > { title } </ h3 >
53
+ { ( subTitle || description ) && (
54
+ < div className = "flex column fs-13 lh-20 fw-4 cn-7" >
55
+ { subTitle && < p className = "m-0" > { subTitle } </ p > }
56
+ { description && < p className = "m-0" > { description } </ p > }
57
+ </ div >
58
+ ) }
59
+ </ div >
60
+
61
+ { reload && (
62
+ < Button
63
+ text = { buttonText }
64
+ onClick = { reload }
65
+ variant = { ButtonVariantType . text }
66
+ size = { ComponentSizeType . small }
67
+ dataTestId = "generic-section-reload-button"
68
+ />
46
69
) }
47
70
</ div >
48
-
49
- { reload && (
50
- < Button
51
- text = { buttonText }
52
- onClick = { reload }
53
- variant = { ButtonVariantType . text }
54
- size = { ComponentSizeType . small }
55
- dataTestId = "generic-section-reload-button"
56
- />
57
- ) }
58
- </ div >
59
- )
71
+ )
72
+ }
60
73
61
74
export default GenericSectionErrorState
0 commit comments