2018-07-05 09:59:42 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { PropTypes } from 'prop-types';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
const Modal = props => (
|
|
|
|
<div className={`modal ${props.isModalOpen ? 'modal-open' : ''} ${props.modalOnMobileOnly ? 'modal-on-mobile-only' : ''} `}>
|
|
|
|
<div className="modal-inner">
|
2018-07-05 11:57:00 +00:00
|
|
|
{ props.children }
|
2018-07-05 09:59:42 +00:00
|
|
|
<div role="button" tabIndex="0" onClick={props.closeModal} className="modal-close">x</div> {/* eslint-disable-line */}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
Modal.propTypes = {
|
2018-07-06 11:46:30 +00:00
|
|
|
isModalOpen: PropTypes.bool,
|
2018-07-05 09:59:42 +00:00
|
|
|
children: PropTypes.shape({}).isRequired,
|
|
|
|
closeModal: PropTypes.func.isRequired,
|
|
|
|
modalOnMobileOnly: PropTypes.bool,
|
|
|
|
};
|
|
|
|
|
|
|
|
Modal.defaultProps = {
|
|
|
|
modalOnMobileOnly: false,
|
2018-07-06 11:46:30 +00:00
|
|
|
isModalOpen: false,
|
2018-07-05 09:59:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Modal;
|