|
|
@ -1,5 +1,7 @@ |
|
|
|
import { Spin, Skeleton, Modal as AntModal } from 'antd'; |
|
|
|
import { Spin, Skeleton, Modal as AntModal } from 'antd'; |
|
|
|
import React, { FC, ReactNode, useState } from 'react'; |
|
|
|
import React, { FC, ReactNode, useState } from 'react'; |
|
|
|
|
|
|
|
import { ErrorBoundary } from 'react-error-boundary'; |
|
|
|
|
|
|
|
import { ComponentError } from '../ComponentError/ComponentError'; |
|
|
|
import styles from './Modal.module.scss'; |
|
|
|
import styles from './Modal.module.scss'; |
|
|
|
|
|
|
|
|
|
|
|
export type ModalProps = { |
|
|
|
export type ModalProps = { |
|
|
@ -70,6 +72,16 @@ export const Modal: FC<ModalProps> = ({ |
|
|
|
footer={null} |
|
|
|
footer={null} |
|
|
|
centered |
|
|
|
centered |
|
|
|
destroyOnClose |
|
|
|
destroyOnClose |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<ErrorBoundary |
|
|
|
|
|
|
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
|
|
|
|
|
|
fallbackRender={({ error, resetErrorBoundary }) => ( |
|
|
|
|
|
|
|
<ComponentError |
|
|
|
|
|
|
|
componentName="Modal" |
|
|
|
|
|
|
|
message={error.message} |
|
|
|
|
|
|
|
retryFunction={resetErrorBoundary} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
)} |
|
|
|
> |
|
|
|
> |
|
|
|
<div id="modal-container" style={{ height: '100%' }}> |
|
|
|
<div id="modal-container" style={{ height: '100%' }}> |
|
|
|
{loading && ( |
|
|
|
{loading && ( |
|
|
@ -80,6 +92,7 @@ export const Modal: FC<ModalProps> = ({ |
|
|
|
{children && <div className={styles.content}>{children}</div>} |
|
|
|
{children && <div className={styles.content}>{children}</div>} |
|
|
|
{loading && <Spin className={styles.spinner} spinning={loading} size="large" />} |
|
|
|
{loading && <Spin className={styles.spinner} spinning={loading} size="large" />} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
</ErrorBoundary> |
|
|
|
</AntModal> |
|
|
|
</AntModal> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|