Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Enhancement] Decouple components and create new factories (#853)

Giuseppe Macrìee204bc14cab
diff --git a/src/components/index.js b/src/components/index.js
index 7a567d94c..433c5589a 100644
--- a/src/components/index.js
+++ b/src/components/index.js
@@ -73,12 +73,14 @@ export {default as LayerHoverInfoFactory} from './map/layer-hover-info';
export {default as CoordinateInfoFactory} from './map/coordinate-info';
// // modal container factories
+export {default as ModalDialoFactory} from './modals/modal-dialog';
export {default as DeleteDatasetModalFactory} from './modals/delete-data-modal';
export {default as DataTableModalFactory} from './modals/data-table-modal';
export {default as LoadDataModalFactory} from './modals/load-data-modal';
export {default as ExportImageModalFactory} from './modals/export-image-modal';
export {default as ExportDataModalFactory} from './modals/export-data-modal';
export {default as AddMapStyleModalFactory} from './modals/add-map-style-modal';
+export {default as ExportMapModalFactory} from './modals/export-map-modal/export-map-modal';
// // common factory
export {default as AnimationControlFactory} from './common/animation-control/animation-control';
diff --git a/src/components/modal-container.js b/src/components/modal-container.js
index 7bb913e60..1f3b2f3f5 100644
--- a/src/components/modal-container.js
+++ b/src/components/modal-container.js
@@ -24,7 +24,7 @@ import {css} from 'styled-components';
import {findDOMNode} from 'react-dom';
import {Blob} from 'global/window';
-import ModalDialog from './common/modal';
+import ModalDialogFactory from './modals/modal-dialog';
import {formatCsv} from 'processors/data-processor';
import KeplerGlSchema from 'schemas';
import {downloadFile, dataURItoBlob} from 'utils/export-image-utils';
@@ -34,7 +34,7 @@ import DataTableModalFactory from './modals/data-table-modal';
import LoadDataModalFactory from './modals/load-data-modal';
import ExportImageModalFactory from './modals/export-image-modal';
import ExportDataModalFactory from './modals/export-data-modal';
-import ExportMapModalFactory from './modals/export-map-modal';
+import ExportMapModalFactory from './modals/export-map-modal/export-map-modal';
import AddMapStyleModalFactory from './modals/add-map-style-modal';
// Breakpoints
@@ -85,7 +85,8 @@ ModalContainerFactory.deps = [
ExportImageModalFactory,
ExportDataModalFactory,
ExportMapModalFactory,
- AddMapStyleModalFactory
+ AddMapStyleModalFactory,
+ ModalDialogFactory
];
export default function ModalContainerFactory(
@@ -95,7 +96,8 @@ export default function ModalContainerFactory(
ExportImageModal,
ExportDataModal,
ExportMapModal,
- AddMapStyleModal
+ AddMapStyleModal,
+ ModalDialog
) {
class ModalWrapper extends Component {
static propTypes = {
diff --git a/src/components/modals/export-map-modal.js b/src/components/modals/export-map-modal.js
deleted file mode 100644
index adf833b6e..000000000
--- a/src/components/modals/export-map-modal.js
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright (c) 2019 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import React from 'react';
-import PropTypes from 'prop-types';
-import styled from 'styled-components';
-import JSONPretty from 'react-json-pretty';
-import {GITHUB_EXPORT_HTML_MAP, GITHUB_ADD_DATA_TO_MAP, GITHUB_EXPORT_HTML_MAP_MODES} from 'constants/user-guides';
-import {FileType} from 'components/common/icons';
-import {
- StyledModalContent,
- StyledExportSection,
- StyledType
-} from 'components/common/styled-components';
-import {
- DISCLAIMER,
- EXPORT_MAP_FORMATS,
- EXPORT_MAP_FORMAT_OPTIONS,
- EXPORT_HTML_MAP_MODE_OPTIONS,
- MAP_CONFIG_DESCRIPTION,
- TOKEN_MISUSE_WARNING
-} from 'constants/default-settings';
-
-const NO_OP = () => {};
-
-const StyledInput = styled.input`
- width: 100%;
- padding: ${props => props.theme.inputPadding};
- color: ${props => props.error ? 'red' : props.theme.titleColorLT};
- height: ${props => props.theme.inputBoxHeight};
- outline: 0;
- font-size: ${props => props.theme.inputFontSize};
-
- :active,
- :focus,
- &.focus,
- &.active {
- outline: 0;
- }
-`;
-
-const StyledWarning = styled.span`
- color: ${props => props.theme.errorColor};
- font-weight: ${props => props.theme.selectFontWeightBold};
-`;
-
-const StyledLink = styled.a`
- text-decoration-line: underline !important;
-`;
-
-const INTRA_SECTION_MARGING = '8px';
-
-const ExportMapStyledExportSection = styled(StyledExportSection)`
- .disclaimer {
- font-size: ${props => props.theme.inputFontSize};
- color: ${props => props.theme.inputColor};
- margin-top: 12px;
- }
-`;
-
-const Link = ({children, ...props}) => (
- <StyledLink target="_blank"
- rel="noopener noreferrer" {...props}>
- {children}
- </StyledLink>
-);
-
-const BigStyledType = styled(StyledType)`
- height: unset;
- width: unset;
- img {
- width: 180px;
- height: 120px;
- }
-`;
-
-const exportHtmlPropTypes = {
- options: PropTypes.object,
- onEditUserMapboxAccessToken: PropTypes.func.isRequired
-};
-
-const ExportHtmlMap = ({
- onChangeExportMapHTMLMode = NO_OP,
- onEditUserMapboxAccessToken = NO_OP,
- options = {}
-}) => (
- <div>
- <StyledExportSection style={{marginTop: INTRA_SECTION_MARGING}}>
- <div className="description" />
- <div className="selection">
- Export your map into an interactive html file.
- </div>
- </StyledExportSection>
- <ExportMapStyledExportSection className="export-map-modal__html-options">
- <div className="description">
- <div className="title">
- Mapbox access token
- </div>
- <div className="subtitle">
- Use your own Mapbox access token in the html (optional)
- </div>
- </div>
- <div className="selection">
- <StyledInput
- onChange={e => onEditUserMapboxAccessToken(e.target.value)}
- type="text"
- placeholder="Paste your Mapbox access token"
- value={options ? options.userMapboxToken : ''}
- />
- <div className="disclaimer">
- <StyledWarning>{TOKEN_MISUSE_WARNING}</StyledWarning>
- <span>{DISCLAIMER}</span>
- <Link href={GITHUB_EXPORT_HTML_MAP}>
- How to update an existing map token.
- </Link>
- </div>
- </div>
- </ExportMapStyledExportSection>
- <ExportMapStyledExportSection>
- <div className="description">
- <div className="title">
- Map Mode
- </div>
- <div className="subtitle">
- Select the app mode. More <a href={GITHUB_EXPORT_HTML_MAP_MODES}>info</a>
- </div>
- </div>
- <div className="selection">
- {EXPORT_HTML_MAP_MODE_OPTIONS.map(mode =>
- <BigStyledType
- key={mode.id}
- selected={options.mode === mode.id}
- available={mode.available}
- onClick={() => mode.available && onChangeExportMapHTMLMode(mode.id)}
- >
- <img src={mode.url} alt=""/>
- <p>Allow users to {mode.label} the map</p>
- </BigStyledType>
- )}
- </div>
- </ExportMapStyledExportSection>
- </div>
-);
-
-ExportHtmlMap.propTypes = exportHtmlPropTypes;
-
-const StyledJsonExportSection = styled(ExportMapStyledExportSection)`
- .note {
- color: ${props => props.theme.errorColor};
- font-size: 11px;
- }
-
- .viewer {
- border: 1px solid ${props => props.theme.selectBorderColorLT};
- background-color: white;
- border-radius: 2px;
- display: inline-block;
- font: inherit;
- line-height: 1.5em;
- padding: 0.5em 3.5em 0.5em 1em;
- margin: 0;
- box-sizing: border-box;
- height: 180px;
- width: 100%;
- overflow-y: scroll;
- overflow-x: auto;
- white-space: pre-wrap;
- word-wrap: break-word;
- max-width: 600px;
- }
-`;
-
-const exportJsonPropTypes = {
- options: PropTypes.object
-};
-
-const ExportJsonMap = ({
- config = {}
-}) => (
- <div>
- <StyledExportSection style={{marginTop: INTRA_SECTION_MARGING}}>
- <div className="description" />
- <div className="selection">
- Export current map data and config into a single Json file. You can later open the same map by uploading this file to kepler.gl.
- </div>
- </StyledExportSection>
- <StyledJsonExportSection className="export-map-modal__json-options">
- <div className="description">
- <div className="title">
- Map Config
- </div>
- <div className="subtitle">
- {MAP_CONFIG_DESCRIPTION}
- <Link href={GITHUB_ADD_DATA_TO_MAP}>
- addDataToMap
- </Link>.
- </div>
- </div>
- <div className="selection">
- <div className="viewer">
- <JSONPretty id="json-pretty" json={config}/>
- </div>
- <div className="disclaimer">
- <StyledWarning>
- * Map config is coupled with loaded datasets. ‘dataId’ is used to bind layers, filters, and tooltips to a specific dataset. When passing this config to addDataToMap, make sure the dataset id matches the dataId/s in this config.
- </StyledWarning>
- </div>
- </div>
- </StyledJsonExportSection>
- </div>
-);
-
-ExportJsonMap.propTypes = exportJsonPropTypes;
-
-const propTypes = {
- options: PropTypes.object,
- onEditUserMapboxAccessToken: PropTypes.func.isRequired,
- onChangeExportData: PropTypes.func,
- onChangeExportMapType: PropTypes.func,
- mapFormat: PropTypes.string
-};
-
-const style = {width: '100%'};
-
-const ExportMapModal = ({
- config = {},
- onChangeExportData = NO_OP,
- onChangeExportMapFormat = NO_OP,
- onChangeExportMapHTMLMode = NO_OP,
- onEditUserMapboxAccessToken = NO_OP,
- options = {}
-}) => (
- <StyledModalContent className="export-map-modal">
- <div style={style}>
- <StyledExportSection style={{marginBottom: INTRA_SECTION_MARGING}}>
- <div className="description">
- <div className="title">
- Map format
- </div>
- <div className="subtitle">
- Choose the format to export your map to
- </div>
- </div>
- <div className="selection">
- {EXPORT_MAP_FORMAT_OPTIONS.map(op =>
- <StyledType
- key={op.id}
- selected={options.format === op.id}
- available={op.available}
- onClick={() => op.available && onChangeExportMapFormat(op.id)}
- >
- <FileType ext={op.label} height="80px" fontSize="11px" />
- </StyledType>
- )}
- </div>
- </StyledExportSection>
- {{
- [EXPORT_MAP_FORMATS.HTML]: (
- <ExportHtmlMap
- onChangeExportMapHTMLMode={onChangeExportMapHTMLMode}
- onEditUserMapboxAccessToken={onEditUserMapboxAccessToken}
- options={options[options.format]}
- />
- ),
- [EXPORT_MAP_FORMATS.JSON]: (
- <ExportJsonMap
- config={config}
- onChangeExportData={onChangeExportData}
- options={options[options.format]}
- />
- )
- }[options.format]}
- </div>
- </StyledModalContent>
-);
-
-ExportMapModal.propTypes = propTypes;
-
-const ExportMapModalFactory = () => ExportMapModal;
-
-export default ExportMapModalFactory;
diff --git a/src/components/modals/export-map-modal/components.js b/src/components/modals/export-map-modal/components.js
new file mode 100644
index 000000000..febe29eef
--- /dev/null
+++ b/src/components/modals/export-map-modal/components.js
@@ -0,0 +1,25 @@
+import React from 'react';
+import styled from 'styled-components';
+import {
+ StyledExportSection
+} from 'components/common/styled-components';
+
+export const StyledExportMapSection = styled(StyledExportSection)`
+ margin-top: ${props => props.theme.exportIntraSectionMargin}px;
+`;
+
+export const StyledWarning = styled.span`
+ color: ${props => props.theme.errorColor};
+ font-weight: ${props => props.theme.selectFontWeightBold};
+`;
+
+export const StyledExportLink = styled.a`
+ text-decoration-line: underline !important;
+`;
+
+export const ExportMapLink = ({children, ...props}) => (
+ <StyledExportLink target="_blank"
+ rel="noopener noreferrer" {...props}>
+ {children}
+ </StyledExportLink>
+);
diff --git a/src/components/modals/export-map-modal/export-html-map.js b/src/components/modals/export-map-modal/export-html-map.js
new file mode 100644
index 000000000..1e67dfe1b
--- /dev/null
+++ b/src/components/modals/export-map-modal/export-html-map.js
@@ -0,0 +1,131 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import {
+ StyledExportSection,
+ StyledType
+} from 'components/common/styled-components';
+import {
+ StyledExportMapSection,
+ StyledWarning,
+ ExportMapLink
+} from './components';
+import {
+ DISCLAIMER,
+ EXPORT_HTML_MAP_MODE_OPTIONS,
+ TOKEN_MISUSE_WARNING
+} from 'constants/default-settings';
+import {
+ GITHUB_EXPORT_HTML_MAP,
+ GITHUB_EXPORT_HTML_MAP_MODES
+} from 'constants/user-guides';
+import styled from 'styled-components';
+
+const NO_OP = () => {};
+
+const ExportMapStyledExportSection = styled(StyledExportSection)`
+ .disclaimer {
+ font-size: ${props => props.theme.inputFontSize};
+ color: ${props => props.theme.inputColor};
+ margin-top: 12px;
+ }
+`;
+
+const StyledInput = styled.input`
+ width: 100%;
+ padding: ${props => props.theme.inputPadding};
+ color: ${props => props.error ? 'red' : props.theme.titleColorLT};
+ height: ${props => props.theme.inputBoxHeight};
+ outline: 0;
+ font-size: ${props => props.theme.inputFontSize};
+
+ :active,
+ :focus,
+ &.focus,
+ &.active {
+ outline: 0;
+ }
+`;
+
+const BigStyledTile = styled(StyledType)`
+ height: unset;
+ width: unset;
+ img {
+ width: 180px;
+ height: 120px;
+ }
+`;
+
+const exportHtmlPropTypes = {
+ options: PropTypes.object,
+ onEditUserMapboxAccessToken: PropTypes.func.isRequired
+};
+
+const ExportHtmlMap = React.memo(({
+ onChangeExportMapHTMLMode = NO_OP,
+ onEditUserMapboxAccessToken = NO_OP,
+ options = {}
+}) => (
+ <div>
+ <StyledExportMapSection>
+ <div className="description" />
+ <div className="selection">
+ Export your map into an interactive html file.
+ </div>
+ </StyledExportMapSection>
+ <ExportMapStyledExportSection className="export-map-modal__html-options">
+ <div className="description">
+ <div className="title">
+ Mapbox access token
+ </div>
+ <div className="subtitle">
+ Use your own Mapbox access token in the html (optional)
+ </div>
+ </div>
+ <div className="selection">
+ <StyledInput
+ onChange={e => onEditUserMapboxAccessToken(e.target.value)}
+ type="text"
+ placeholder="Paste your Mapbox access token"
+ value={options ? options.userMapboxToken : ''}
+ />
+ <div className="disclaimer">
+ <StyledWarning>{TOKEN_MISUSE_WARNING}</StyledWarning>
+ <span>{DISCLAIMER}</span>
+ <ExportMapLink href={GITHUB_EXPORT_HTML_MAP}>
+ How to update an existing map token.
+ </ExportMapLink>
+ </div>
+ </div>
+ </ExportMapStyledExportSection>
+ <ExportMapStyledExportSection>
+ <div className="description">
+ <div className="title">
+ Map Mode
+ </div>
+ <div className="subtitle">
+ Select the app mode. More <a href={GITHUB_EXPORT_HTML_MAP_MODES}>info</a>
+ </div>
+ </div>
+ <div className="selection">
+ {EXPORT_HTML_MAP_MODE_OPTIONS.map(mode =>
+ <BigStyledTile
+ key={mode.id}
+ selected={options.mode === mode.id}
+ available={mode.available}
+ onClick={() => mode.available && onChangeExportMapHTMLMode(mode.id)}
+ >
+ <img src={mode.url} alt=""/>
+ <p>Allow users to {mode.label} the map</p>
+ </BigStyledTile>
+ )}
+ </div>
+ </ExportMapStyledExportSection>
+ </div>
+));
+
+ExportHtmlMap.propTypes = exportHtmlPropTypes;
+
+const ExportHtmlMapFactory = () => ExportHtmlMap;
+
+export default ExportHtmlMapFactory;
+
diff --git a/src/components/modals/export-map-modal/export-json-map.js b/src/components/modals/export-map-modal/export-json-map.js
new file mode 100644
index 000000000..1dcbf45c6
--- /dev/null
+++ b/src/components/modals/export-map-modal/export-json-map.js
@@ -0,0 +1,86 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import JSONPretty from 'react-json-pretty';
+import {GITHUB_ADD_DATA_TO_MAP} from 'constants/user-guides';
+import {MAP_CONFIG_DESCRIPTION} from 'constants/default-settings';
+import styled from 'styled-components';
+import {
+ StyledExportSection
+} from 'components/common/styled-components';
+import {
+ StyledExportMapSection,
+ StyledWarning,
+ ExportMapLink
+} from './components';
+
+const StyledJsonExportSection = styled(StyledExportSection)`
+ .note {
+ color: ${props => props.theme.errorColor};
+ font-size: 11px;
+ }
+
+ .viewer {
+ border: 1px solid ${props => props.theme.selectBorderColorLT};
+ background-color: white;
+ border-radius: 2px;
+ display: inline-block;
+ font: inherit;
+ line-height: 1.5em;
+ padding: 0.5em 3.5em 0.5em 1em;
+ margin: 0;
+ box-sizing: border-box;
+ height: 180px;
+ width: 100%;
+ overflow-y: scroll;
+ overflow-x: auto;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ max-width: 600px;
+ }
+`;
+
+const exportJsonPropTypes = {
+ options: PropTypes.object
+};
+
+const ExportJsonMap = React.memo(({
+ config = {}
+}) => (
+ <div>
+ <StyledExportMapSection>
+ <div className="description" />
+ <div className="selection">
+ Export current map data and config into a single Json file. You can later open the same map by uploading this file to kepler.gl.
+ </div>
+ </StyledExportMapSection>
+ <StyledJsonExportSection className="export-map-modal__json-options">
+ <div className="description">
+ <div className="title">
+ Map Config
+ </div>
+ <div className="subtitle">
+ {MAP_CONFIG_DESCRIPTION}
+ <ExportMapLink href={GITHUB_ADD_DATA_TO_MAP}>
+ addDataToMap
+ </ExportMapLink>.
+ </div>
+ </div>
+ <div className="selection">
+ <div className="viewer">
+ <JSONPretty id="json-pretty" json={config}/>
+ </div>
+ <div className="disclaimer">
+ <StyledWarning>
+ * Map config is coupled with loaded datasets. ‘dataId’ is used to bind layers, filters, and tooltips to a specific dataset. When passing this config to addDataToMap, make sure the dataset id matches the dataId/s in this config.
+ </StyledWarning>
+ </div>
+ </div>
+ </StyledJsonExportSection>
+ </div>
+));
+
+ExportJsonMap.propTypes = exportJsonPropTypes;
+
+const ExportJsonMapFactory = () => ExportJsonMap;
+
+export default ExportJsonMapFactory;
diff --git a/src/components/modals/export-map-modal/export-map-modal.js b/src/components/modals/export-map-modal/export-map-modal.js
new file mode 100644
index 000000000..2333e8832
--- /dev/null
+++ b/src/components/modals/export-map-modal/export-map-modal.js
@@ -0,0 +1,117 @@
+// Copyright (c) 2019 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import {FileType} from 'components/common/icons';
+import {
+ StyledModalContent,
+ StyledType
+} from 'components/common/styled-components';
+import {
+ EXPORT_MAP_FORMATS,
+ EXPORT_MAP_FORMAT_OPTIONS
+} from 'constants/default-settings';
+import {
+ StyledExportMapSection
+} from './components';
+import ExportHtmlMapFactory from './export-html-map';
+import ExportJsonMapFactory from './export-json-map';
+
+const propTypes = {
+ options: PropTypes.object,
+ onEditUserMapboxAccessToken: PropTypes.func.isRequired,
+ onChangeExportData: PropTypes.func,
+ onChangeExportMapType: PropTypes.func,
+ mapFormat: PropTypes.string
+};
+
+const style = {width: '100%'};
+
+const NO_OP = () => {};
+
+ExportMapModalFactory.deps = [
+ ExportHtmlMapFactory,
+ ExportJsonMapFactory
+];
+
+function ExportMapModalFactory(
+ ExportHtmlMap,
+ ExportJsonMap
+) {
+ const ExportMapModal = React.memo(({
+ config = {},
+ onChangeExportData = NO_OP,
+ onChangeExportMapFormat = NO_OP,
+ onChangeExportMapHTMLMode = NO_OP,
+ onEditUserMapboxAccessToken = NO_OP,
+ options = {}
+ }) => (
+ <StyledModalContent className="export-map-modal">
+ <div style={style}>
+ <StyledExportMapSection>
+ <div className="description">
+ <div className="title">
+ Map format
+ </div>
+ <div className="subtitle">
+ Choose the format to export your map to
+ </div>
+ </div>
+ <div className="selection">
+ {EXPORT_MAP_FORMAT_OPTIONS.map(op =>
+ <StyledType
+ key={op.id}
+ selected={options.format === op.id}
+ available={op.available}
+ onClick={() => op.available && onChangeExportMapFormat(op.id)}
+ >
+ <FileType ext={op.label} height="80px" fontSize="11px" />
+ </StyledType>
+ )}
+ </div>
+ </StyledExportMapSection>
+ {{
+ [EXPORT_MAP_FORMATS.HTML]: (
+ <ExportHtmlMap
+ onChangeExportMapHTMLMode={onChangeExportMapHTMLMode}
+ onEditUserMapboxAccessToken={onEditUserMapboxAccessToken}
+ options={options[options.format]}
+ />
+ ),
+ [EXPORT_MAP_FORMATS.JSON]: (
+ <ExportJsonMap
+ config={config}
+ onChangeExportData={onChangeExportData}
+ options={options[options.format]}
+ />
+ )
+ }[options.format]}
+ </div>
+ </StyledModalContent>
+ ));
+
+ ExportMapModal.propTypes = propTypes;
+
+ return ExportMapModal;
+}
+
+export default ExportMapModalFactory;
diff --git a/src/components/modals/modal-dialog.js b/src/components/modals/modal-dialog.js
new file mode 100644
index 000000000..c4d8c2c5b
--- /dev/null
+++ b/src/components/modals/modal-dialog.js
@@ -0,0 +1,5 @@
+import Modal from 'components/common/modal';
+
+const ModalDialogFactory = () => Modal;
+
+export default ModalDialogFactory;
diff --git a/src/reducers/ui-state-updaters.js b/src/reducers/ui-state-updaters.js
index 791fa0155..a990be233 100644
--- a/src/reducers/ui-state-updaters.js
+++ b/src/reducers/ui-state-updaters.js
@@ -606,7 +606,7 @@ export const loadFilesErrUpdater = (state, {error}) =>
},
{
payload: errorNotification({
- message: (error || {}).message || 'Failde to upload files',
+ message: (error || {}).message || 'Failed to upload files',
topic: DEFAULT_NOTIFICATION_TOPICS.global
})
}
diff --git a/src/styles/base.js b/src/styles/base.js
index 0e1e8b692..633372494 100644
--- a/src/styles/base.js
+++ b/src/styles/base.js
@@ -144,7 +144,7 @@ export const switchTrackBorderRadius = '1px';
export const switchBtnBgd = '#6A7485';
export const switchBtnBgdActive = '#D3D8E0';
export const switchBtnBoxShadow = '0 2px 4px 0 rgba(0,0,0,0.40)';
-export const switchBtnBorderRadius = '1px';
+export const switchBtnBorderRadius = '0';
export const switchBtnWidth = '12px';
export const switchBtnHeight = '12px';
@@ -268,6 +268,9 @@ const timeDisplayMinWidth = 176;
const timeDisplayOpacity = 0.8;
const timeDisplayPadding = '0 24px';
+// Export map modal
+const exportIntraSectionMargin = '8';
+
export const textTruncate = {
maxWidth: '100%',
overflow: 'hidden',
@@ -495,6 +498,7 @@ const switchButton = css`
background: ${props =>
props.checked ? props.theme.switchBtnBgdActive : props.theme.switchBtnBgd};
box-shadow: ${props => props.theme.switchBtnBoxShadow};
+ border-radius: ${props => props.theme.switchBtnBorderRadius};
`;
const inputSwitch = css`
@@ -1051,6 +1055,10 @@ export const theme = {
timeDisplayMinWidth,
timeDisplayOpacity,
timeDisplayPadding,
+
+ // export map
+ exportIntraSectionMargin,
+
// Breakpoints
breakPoints
};