import React from 'react'; import PropTypes from 'prop-types'; import Icon from './Icon'; class Modal extends React.Component { render() { // Render nothing if the "show" prop is false if (!this.props.show) { return null; } // The gray background const backdropStyle = { position: 'fixed', top: 0, bottom: 0, left: 0, right: 0, backgroundColor: 'rgba(0,0,0,0.3)', padding: 50 }; return (
{this.props.children}
); } } Modal.propTypes = { onClose: PropTypes.func.isRequired, show: PropTypes.bool, children: PropTypes.node }; export default Modal;