|
|
@@ -1,6 +1,6 @@
|
|
|
import ReactModal from 'react-modal';
|
|
|
import {Close} from '@icon-park/react';
|
|
|
-import {FC, PropsWithChildren, useEffect} from 'react';
|
|
|
+import {FC, PropsWithChildren} from 'react';
|
|
|
|
|
|
const styles: ReactModal.Styles = {
|
|
|
content: {
|
|
|
@@ -14,28 +14,18 @@ const styles: ReactModal.Styles = {
|
|
|
type Props = {
|
|
|
visible: boolean;
|
|
|
onClose: () => void;
|
|
|
- testId?: string;
|
|
|
+ 'data-testid'?: string;
|
|
|
};
|
|
|
|
|
|
-const PageModal: FC<PropsWithChildren<Props>> = function({
|
|
|
- children,
|
|
|
- visible,
|
|
|
- onClose,
|
|
|
- testId,
|
|
|
-}) {
|
|
|
- useEffect(
|
|
|
- function() {
|
|
|
- if (visible)
|
|
|
- document.body.classList.add('lock-scroll');
|
|
|
- else
|
|
|
- document.body.classList.remove('lock-scroll');
|
|
|
- },
|
|
|
- [visible],
|
|
|
- );
|
|
|
+const PageModal: FC<PropsWithChildren<Props>> = function(props) {
|
|
|
+ const {
|
|
|
+ children,
|
|
|
+ visible,
|
|
|
+ onClose,
|
|
|
+ } = props;
|
|
|
|
|
|
return (
|
|
|
<ReactModal
|
|
|
- data-testid={testId}
|
|
|
shouldCloseOnOverlayClick
|
|
|
onRequestClose={onClose}
|
|
|
isOpen={visible}
|
|
|
@@ -43,7 +33,7 @@ const PageModal: FC<PropsWithChildren<Props>> = function({
|
|
|
style={styles}
|
|
|
closeTimeoutMS={200}
|
|
|
>
|
|
|
- <section className="ld-page-dialog">
|
|
|
+ <section className="ld-page-dialog" data-testid={props['data-testid']}>
|
|
|
<div className="ld-page-dialog-close">
|
|
|
<Close
|
|
|
className="ld-page-dialog-close-icon"
|