Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix styling of templates in modal #1576

Benjamin King8118058bc7a5
diff --git a/web/css/modal.css b/web/css/modal.css
index 4db0370a1..4c0d91b31 100644
--- a/web/css/modal.css
+++ b/web/css/modal.css
@@ -4,9 +4,24 @@
background: #282828;
color: #eee;
}
-.modal-dialog .close {
+.modal-dialog .close, .modal-body pre {
color: #fff;
}
.clickable-behind-modal .modal {
position: inherit;
}
+.template-modal.modal-dialog {
+ max-width: 625px;
+}
+.template-modal .modal-content {
+ width: 625px;
+}
+.template-modal .modal-body ul {
+ margin: 10px 0;
+ padding-left: 20px;
+}
+.template-modal .modal-body li {
+ display: list-item;
+ list-style-type: disc;
+ margin: 2px 0 2px 20px;
+}
\ No newline at end of file
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index ed8e3ffd9..c083bdd6e 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import update from 'immutability-helper';
-import { toLower } from 'lodash';
+import { toLower as lodashToLower } from 'lodash';
import { Modal, ModalBody, ModalHeader } from 'reactstrap';
import { onToggle } from '../modules/modal/actions';
import DetectOuterClick from '../components/util/detect-outer-click';
@@ -21,7 +21,7 @@ class ModalContainer extends Component {
<span> Loading </span>
) : (
<div
- id="page"
+ id="template-content"
dangerouslySetInnerHTML={{ __html: bodyTemplate.response }}
/>
);
@@ -46,15 +46,18 @@ class ModalContainer extends Component {
bodyComponent
} = newProps;
const style = this.getStyle(newProps);
- const lowerCaseId = toLower(id);
+ const lowerCaseId = lodashToLower(id);
const BodyComponent = bodyComponent || '';
+
return (
<Modal
isOpen={isOpen}
toggle={onToggle}
backdrop={backdrop && type !== 'selection'}
id={lowerCaseId}
- className={modalClassName || 'default-modal'}
+ className={
+ isTemplateModal ? 'template-modal' : modalClassName || 'default-modal'
+ }
autoFocus={autoFocus || false}
style={style}
wrapClassName={wrapClassName + ' ' + lowerCaseId}
@@ -130,7 +133,7 @@ export default connect(
ModalContainer.propTypes = {
isCustom: PropTypes.bool,
id: PropTypes.string,
- bodyTemplate: PropTypes.node,
+ bodyTemplate: PropTypes.object,
isOpen: PropTypes.bool,
isTemplateModal: PropTypes.bool,
customProps: PropTypes.object
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index ac1f5b2b3..9401c8f92 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -181,5 +181,6 @@ toolbarContainer.propTypes = {
openModal: PropTypes.func,
notificationType: PropTypes.string,
notificationContentNumber: PropTypes.number,
+ requestNotifications: PropTypes.func,
config: PropTypes.object
};
diff --git a/web/js/modules/modal/reducers.js b/web/js/modules/modal/reducers.js
index 579ca724a..bc6a252c8 100644
--- a/web/js/modules/modal/reducers.js
+++ b/web/js/modules/modal/reducers.js
@@ -19,7 +19,8 @@ export const modalState = {
bodyChildren: null,
isCustom: false,
bodyHTML: null,
- customProps: {}
+ customProps: {},
+ template: null
};
export function modalAboutPage(state = {}, action) {
return requestReducer(ABOUT_PAGE_REQUEST, state, action);
@@ -37,7 +38,8 @@ export function modalReducer(state = modalState, action) {
id: action.key,
headerText: action.headerText || '',
bodyText: action.bodyText || '',
- customProps: {}
+ customProps: {},
+ template: null
});
case OPEN_CUSTOM:
return lodashAssign({}, state, {
@@ -46,7 +48,8 @@ export function modalReducer(state = modalState, action) {
customProps: action.customProps,
id: action.key,
headerText: action.headerText || '',
- bodyText: action.bodyText || ''
+ bodyText: action.bodyText || '',
+ template: null
});
case RENDER_TEMPLATE:
return lodashAssign({}, state, {