summaryrefslogtreecommitdiff
path: root/src/components/shared/BaseModal.js
blob: dcd0b577b0f3d9639eaedbb9331080cdf0bda7e1 (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
import cx from 'clsx';
import * as React from 'react';
import Modal from 'react-modal';

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>
  );
}