Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Add `desktopOnly` to modal custom props #1755

Benjamin King5412a8c867ed
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index 9257752b4..b55d785a7 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -51,7 +51,14 @@ class ModalContainer extends Component {
);
}
render() {
- const { isCustom, id, isOpen, isTemplateModal, customProps } = this.props;
+ const {
+ isCustom,
+ id,
+ isOpen,
+ isTemplateModal,
+ customProps,
+ isMobile
+ } = this.props;
// Populate props from custom obj
const newProps =
isCustom && id ? update(this.props, { $merge: customProps }) : this.props;
@@ -71,8 +78,10 @@ class ModalContainer extends Component {
onClose,
CompletelyCustomModal,
bodyComponentProps,
- timeout
+ timeout,
+ desktopOnly
} = newProps;
+
const style = this.getStyle(newProps);
const lowerCaseId = lodashToLower(id);
const BodyComponent = bodyComponent || '';
@@ -82,6 +91,9 @@ class ModalContainer extends Component {
onClose();
}
};
+ if (isMobile && isOpen && desktopOnly) {
+ toggleWithClose();
+ }
return (
<ErrorBoundary>
<Modal
@@ -154,6 +166,7 @@ function mapStateToProps(state) {
headerText,
isCustom,
id,
+ isMobile: state.browser.lessThan.medium,
bodyTemplate,
isTemplateModal,
customProps
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index 913b2fb39..81f5b139b 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -54,7 +54,8 @@ const CUSTOM_MODAL_PROPS = {
type: 'selection',
offsetRight: '70px',
modalClassName: 'toolbar-snapshot-modal toolbar-modal toolbar-medium-modal',
- bodyComponent: ImageDownload
+ bodyComponent: ImageDownload,
+ desktopOnly: true
}
};
class toolbarContainer extends Component {