wire up UI Services

This commit is contained in:
dannyrb committed 2020-05-23 23:38:20 -04:00
1 parent c9a4ab13ef
commit db76eac047
14 files changed
+662 -28

No files matched your search

@@ -0,0 +1,72 @@
import React from 'react';
import PropTypes from 'prop-types';
import ReactModal from 'react-modal';
import classNames from 'classnames';
const customStyle = {
overlay: {
zIndex: 1071,
backgroundColor: 'rgb(0, 0, 0, 0.5)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
};
ReactModal.setAppElement(document.getElementById('root'));
const Modal = ({
className,
closeButton,
shouldCloseOnEsc,
isOpen,
title,
onClose,
children,
}) => {
const renderHeader = () => {
return (
title && (
<header>
<h4>{title}</h4>
{closeButton && (
<button data-cy="close-button" onClick={onClose}>
×
</button>
)}
</header>
)
);
};
return (
<ReactModal
className={classNames(className)}
shouldCloseOnEsc={shouldCloseOnEsc}
isOpen={isOpen}
title={title}
style={customStyle}
>
<>
{renderHeader()}
<section>{children}</section>
</>
</ReactModal>
);
};
Modal.propTypes = {
className: PropTypes.string,
closeButton: PropTypes.bool,
shouldCloseOnEsc: PropTypes.bool,
isOpen: PropTypes.bool,
title: PropTypes.string,
onClose: PropTypes.func,
/** The modal's content */
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
]).isRequired,
};
export default Modal;
@@ -0,0 +1,2 @@
import Modal from './Modal';
export default Modal;