diff --git a/src/components/modals/LoadingModal.jsx b/src/components/modals/LoadingModal.jsx new file mode 100644 index 00000000..42b8ecaf --- /dev/null +++ b/src/components/modals/LoadingModal.jsx @@ -0,0 +1,49 @@ +import React from 'react' +import PropTypes from 'prop-types' + +import Button from '../Button' +import Modal from './Modal' + + +class LoadingModal extends React.Component { + static propTypes = { + isOpen: PropTypes.bool.isRequired, + onCancel: PropTypes.func.isRequired, + title: PropTypes.string.isRequired, + message: PropTypes.node.isRequired, + } + + constructor(props) { + super(props); + } + + underlayOnClick(e) { + // This stops click events falling through to underlying modals. + e.stopPropagation(); + } + + render() { + return underlayProps(e) + }} + closeable={false} + title={this.props.title} + onOpenToggle={() => this.props.onCancel()} + > +

+ {this.props.message} +

+

+ +

+
+ } +} + +export default LoadingModal diff --git a/src/components/modals/Modal.jsx b/src/components/modals/Modal.jsx index 2a4a97c9..58bbbdcd 100644 --- a/src/components/modals/Modal.jsx +++ b/src/components/modals/Modal.jsx @@ -11,6 +11,12 @@ class Modal extends React.Component { title: PropTypes.string.isRequired, onOpenToggle: PropTypes.func.isRequired, children: PropTypes.node, + underlayClickExits: PropTypes.bool, + underlayProps: PropTypes.object, + } + + static defaultProps = { + underlayClickExits: true } getApplicationNode() { @@ -21,6 +27,8 @@ class Modal extends React.Component { if(this.props.isOpen) { return - this.onCancelActiveRequest()} - > -

- Loading: {this.state.activeRequestUrl} -

-

- -

-
+ onCancel={(e) => this.onCancelActiveRequest(e)} + message={"Loading: "+this.state.activeRequestUrl} + /> } }