summaryrefslogtreecommitdiff
path: root/src/components/shared/BaseModal.js
blob: 3c32a15416cf530dad7f3a2ea059de2df2a3e8de (plain)
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
import * as React from 'react';

import Modal from 'react-modal';
import cx from 'clsx';

import modalStyle from '../Modal.module.css';
import s from './BaseModal.module.css';

const { useMemo } = React;

export default function BaseModal({ isOpen, onRequestClose, children }) {
  const className = useMemo(
    () => ({
      base: cx(modalStyle.content, s.cnt),
      afterOpen: s.afterOpen,
      beforeClose: '',
    }),
    []
  );
  return (
    <Modal
      isOpen={isOpen}
      onRequestClose={onRequestClose}
      className={className}
      overlayClassName={cx(modalStyle.overlay, s.overlay)}
    >
      {children}
    </Modal>
  );
}