@urbanos/react-discovery-ui 2.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +118 -0
- package/lib/ReactDiscoveryUI.js +103 -0
- package/lib/ReactDiscoveryUI.scss +13 -0
- package/lib/assets/arrow.svg +6 -0
- package/lib/assets/blk-database.svg +48 -0
- package/lib/assets/chart.svg +1 -0
- package/lib/assets/down.png +0 -0
- package/lib/assets/down.svg +1 -0
- package/lib/assets/folder_icon.png +0 -0
- package/lib/assets/folder_icon.svg +1 -0
- package/lib/assets/ic_arrow.svg +15 -0
- package/lib/assets/loadingicon.svg +57 -0
- package/lib/assets/no_image.png +0 -0
- package/lib/assets/plus.png +0 -0
- package/lib/assets/plus.svg +1 -0
- package/lib/assets/user.svg +1 -0
- package/lib/auth/auth0-client-provider.js +37 -0
- package/lib/auth/auth0-client-provider.test.js +33 -0
- package/lib/auth/auth0-wrapper.js +155 -0
- package/lib/auth/auth0-wrapper.test.js +100 -0
- package/lib/components/auth0-login-zone/auth0-login-zone.js +147 -0
- package/lib/components/auth0-login-zone/auth0-login-zone.test.js +177 -0
- package/lib/components/auth0-login-zone/index.js +9 -0
- package/lib/components/code-editor/code-editor.css +173 -0
- package/lib/components/code-editor/code-editor.js +64 -0
- package/lib/components/code-editor/index.js +9 -0
- package/lib/components/collapsable-box/collapsable-box.js +81 -0
- package/lib/components/collapsable-box/collapsable-box.scss +39 -0
- package/lib/components/collapsable-box/collapsable-box.test.js +87 -0
- package/lib/components/collapsable-box/index.js +9 -0
- package/lib/components/data-card/data-card.js +63 -0
- package/lib/components/data-card/data-card.scss +93 -0
- package/lib/components/data-card/data-card.test.js +74 -0
- package/lib/components/data-card/index.js +9 -0
- package/lib/components/data-view/data-view.js +194 -0
- package/lib/components/data-view/data-view.scss +39 -0
- package/lib/components/data-view/data-view.test.js +155 -0
- package/lib/components/data-view/index.js +9 -0
- package/lib/components/dataset-api-doc/api-example.js +120 -0
- package/lib/components/dataset-api-doc/api-example.scss +84 -0
- package/lib/components/dataset-api-doc/api-example.test.js +88 -0
- package/lib/components/dataset-api-doc/dataset-api-doc.js +117 -0
- package/lib/components/dataset-api-doc/dataset-api-doc.scss +8 -0
- package/lib/components/dataset-api-doc/dataset-api-doc.test.js +42 -0
- package/lib/components/dataset-api-doc/index.js +9 -0
- package/lib/components/dataset-details/dataset-details.js +64 -0
- package/lib/components/dataset-details/dataset-details.scss +58 -0
- package/lib/components/dataset-details/dataset-details.test.js +38 -0
- package/lib/components/dataset-details/index.js +9 -0
- package/lib/components/dataset-dictionary/dataset-dictionary.js +127 -0
- package/lib/components/dataset-dictionary/dataset-dictionary.scss +42 -0
- package/lib/components/dataset-dictionary/dataset-dictionary.test.js +286 -0
- package/lib/components/dataset-dictionary/index.js +9 -0
- package/lib/components/dataset-list/dataset-list.js +22 -0
- package/lib/components/dataset-list/dataset-list.scss +9 -0
- package/lib/components/dataset-list/dataset-list.test.js +16 -0
- package/lib/components/dataset-list/index.js +9 -0
- package/lib/components/dataset-metadata/dataset-metadata.js +169 -0
- package/lib/components/dataset-metadata/dataset-metadata.scss +34 -0
- package/lib/components/dataset-metadata/dataset-metadata.test.js +24 -0
- package/lib/components/dataset-metadata/index.js +9 -0
- package/lib/components/dataset-preview/connector.js +26 -0
- package/lib/components/dataset-preview/dataset-preview.js +58 -0
- package/lib/components/dataset-preview/dataset-preview.scss +24 -0
- package/lib/components/dataset-preview/dataset-preview.test.js +34 -0
- package/lib/components/dataset-preview/index.js +9 -0
- package/lib/components/dataset-quality/dataset-quality.js +56 -0
- package/lib/components/dataset-quality/dataset-quality.scss +24 -0
- package/lib/components/dataset-quality/dataset-quality.test.js +34 -0
- package/lib/components/dataset-quality/index.js +9 -0
- package/lib/components/dataset-recommendations/connector.js +24 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.js +47 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.scss +17 -0
- package/lib/components/dataset-recommendations/dataset-recommendations.test.js +37 -0
- package/lib/components/dataset-recommendations/index.js +9 -0
- package/lib/components/detail-toggle-icon/detail-toggle-icon.js +41 -0
- package/lib/components/detail-toggle-icon/detail-toggle-icon.scss +13 -0
- package/lib/components/detail-toggle-icon/detail-toggle-icon.test.js +20 -0
- package/lib/components/detail-toggle-icon/index.js +9 -0
- package/lib/components/facet-list/facet-list.js +47 -0
- package/lib/components/facet-list/facet-list.scss +19 -0
- package/lib/components/facet-list/facet-list.test.js +94 -0
- package/lib/components/facet-list/index.js +9 -0
- package/lib/components/facet-sidebar/facet-sidebar.js +101 -0
- package/lib/components/facet-sidebar/facet-sidebar.scss +129 -0
- package/lib/components/facet-sidebar/facet-sidebar.test.js +93 -0
- package/lib/components/facet-sidebar/index.js +9 -0
- package/lib/components/generic-elements/alert-component/alert-component.js +51 -0
- package/lib/components/generic-elements/alert-component/alert-component.scss +26 -0
- package/lib/components/generic-elements/alert-component/alert-component.test.js +26 -0
- package/lib/components/generic-elements/alert-component/index.js +9 -0
- package/lib/components/generic-elements/arrow-button/arrow-button.js +30 -0
- package/lib/components/generic-elements/arrow-button/index.js +9 -0
- package/lib/components/generic-elements/auto-anchoring-popover/index.js +61 -0
- package/lib/components/generic-elements/back-button/back-button.js +14 -0
- package/lib/components/generic-elements/back-button/back-button.scss +14 -0
- package/lib/components/generic-elements/back-button/index.js +9 -0
- package/lib/components/generic-elements/call-to-action-button/call-to-action-button.js +118 -0
- package/lib/components/generic-elements/call-to-action-button/call-to-action-button.scss +19 -0
- package/lib/components/generic-elements/call-to-action-button/call-to-action-button.test.js +68 -0
- package/lib/components/generic-elements/call-to-action-button/index.js +9 -0
- package/lib/components/generic-elements/chart-icon/index.js +23 -0
- package/lib/components/generic-elements/checkbox/checkbox.js +50 -0
- package/lib/components/generic-elements/checkbox/checkbox.scss +44 -0
- package/lib/components/generic-elements/checkbox/checkbox.test.js +71 -0
- package/lib/components/generic-elements/checkbox/index.js +9 -0
- package/lib/components/generic-elements/error-component/error-component.js +21 -0
- package/lib/components/generic-elements/error-component/error-component.scss +16 -0
- package/lib/components/generic-elements/error-component/error-component.test.js +12 -0
- package/lib/components/generic-elements/error-component/index.js +9 -0
- package/lib/components/generic-elements/folder-icon/index.js +23 -0
- package/lib/components/generic-elements/generated-link/generated-link.js +25 -0
- package/lib/components/generic-elements/generated-link/index.js +13 -0
- package/lib/components/generic-elements/loading-element/index.js +9 -0
- package/lib/components/generic-elements/loading-element/loading-element.js +22 -0
- package/lib/components/generic-elements/loading-element/loading-element.scss +6 -0
- package/lib/components/generic-elements/loading-element/loading-element.test.js +11 -0
- package/lib/components/generic-elements/paginator/index.js +9 -0
- package/lib/components/generic-elements/paginator/paginator.js +84 -0
- package/lib/components/generic-elements/paginator/paginator.scss +38 -0
- package/lib/components/generic-elements/paginator/paginator.test.js +140 -0
- package/lib/components/generic-elements/plus-icon/index.js +21 -0
- package/lib/components/generic-elements/save-indicator/index.js +9 -0
- package/lib/components/generic-elements/save-indicator/save-indicator.js +39 -0
- package/lib/components/generic-elements/save-indicator/save-indicator.scss +31 -0
- package/lib/components/generic-elements/save-indicator/save-indicator.test.js +89 -0
- package/lib/components/generic-elements/search/index.js +9 -0
- package/lib/components/generic-elements/search/search.js +93 -0
- package/lib/components/generic-elements/search/search.scss +90 -0
- package/lib/components/generic-elements/search/search.test.js +41 -0
- package/lib/components/generic-elements/select/index.js +9 -0
- package/lib/components/generic-elements/select/select.js +44 -0
- package/lib/components/generic-elements/select/select.scss +22 -0
- package/lib/components/generic-elements/select/select.test.js +34 -0
- package/lib/components/generic-elements/share-link/index.js +9 -0
- package/lib/components/generic-elements/share-link/share-link.js +23 -0
- package/lib/components/generic-elements/share-link/share-link.scss +17 -0
- package/lib/components/generic-elements/share-link/share-link.test.js +28 -0
- package/lib/components/generic-elements/sql-icon/index.js +20 -0
- package/lib/components/generic-elements/tab-button/index.js +9 -0
- package/lib/components/generic-elements/tab-button/tab-button.js +25 -0
- package/lib/components/generic-elements/tab-button/tab-button.scss +27 -0
- package/lib/components/generic-elements/visualize-button/index.js +9 -0
- package/lib/components/generic-elements/visualize-button/visualize-button.js +37 -0
- package/lib/components/generic-elements/visualize-button/visualize-button.scss +14 -0
- package/lib/components/login-zone/connector.js +25 -0
- package/lib/components/login-zone/index.js +9 -0
- package/lib/components/login-zone/login-svgs-and-text.js +39 -0
- package/lib/components/login-zone/login-zone.js +21 -0
- package/lib/components/login-zone/login-zone.scss +115 -0
- package/lib/components/login-zone/login-zone.test.js +17 -0
- package/lib/components/login-zone/login.js +48 -0
- package/lib/components/login-zone/logout.js +39 -0
- package/lib/components/network-loading-element/connector.js +17 -0
- package/lib/components/network-loading-element/index.js +9 -0
- package/lib/components/network-loading-element/network-loading-element.js +23 -0
- package/lib/components/network-loading-element/network-loading-element.scss +21 -0
- package/lib/components/network-loading-element/network-loading-element.test.js +34 -0
- package/lib/components/organization/index.js +9 -0
- package/lib/components/organization/organization.js +27 -0
- package/lib/components/organization/organization.scss +32 -0
- package/lib/components/protected-route/protected-route.js +101 -0
- package/lib/components/protected-route/protected-route.scss +4 -0
- package/lib/components/protected-route/protected-route.test.js +63 -0
- package/lib/components/query-form/index.js +9 -0
- package/lib/components/query-form/query-form.js +262 -0
- package/lib/components/query-form/query-form.scss +167 -0
- package/lib/components/query-form/query-form.test.js +248 -0
- package/lib/components/recommendation-list/index.js +9 -0
- package/lib/components/recommendation-list/recommendation-list.js +72 -0
- package/lib/components/recommendation-list/recommendation-list.scss +61 -0
- package/lib/components/recommendation-list/recommendation-list.test.js +38 -0
- package/lib/components/remote-toggle/__snapshots__/remote-toggle.test.js.snap +3 -0
- package/lib/components/remote-toggle/index.js +13 -0
- package/lib/components/remote-toggle/remote-toggle.js +35 -0
- package/lib/components/remote-toggle/remote-toggle.scss +0 -0
- package/lib/components/remote-toggle/remote-toggle.test.js +10 -0
- package/lib/components/share/index.js +9 -0
- package/lib/components/share/share.js +109 -0
- package/lib/components/share/share.scss +66 -0
- package/lib/components/streaming-api-doc/index.js +9 -0
- package/lib/components/streaming-api-doc/streaming-api-doc.js +76 -0
- package/lib/components/streaming-api-doc/streaming-api-doc.scss +23 -0
- package/lib/components/streaming-api-doc/streaming-api-doc.test.js +24 -0
- package/lib/components/tooltip/index.js +9 -0
- package/lib/components/tooltip/tooltip.js +17 -0
- package/lib/components/tooltip/tooltip.scss +16 -0
- package/lib/components/tooltip/tooltip.test.js +19 -0
- package/lib/components/visualization-list-menu-item/index.js +9 -0
- package/lib/components/visualization-list-menu-item/visualization-list-menu-item.js +53 -0
- package/lib/components/visualization-list-menu-item/visualization-list-menu-item.scss +21 -0
- package/lib/components/visualization-list-menu-item/visualization-list-menu-item.test.js +42 -0
- package/lib/components/visualization-save-menu-item/index.js +9 -0
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.js +101 -0
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.scss +37 -0
- package/lib/components/visualization-save-menu-item/visualization-save-menu-item.test.js +185 -0
- package/lib/components/visualizations/geojson/connector.js +29 -0
- package/lib/components/visualizations/geojson/geojson-visualization.js +151 -0
- package/lib/components/visualizations/geojson/geojson-visualization.scss +24 -0
- package/lib/components/visualizations/geojson/geojson-visualization.test.js +238 -0
- package/lib/components/visualizations/geojson/index.js +9 -0
- package/lib/pages/apikey-view/apiKey-view.test.js +204 -0
- package/lib/pages/apikey-view/apikey-view.js +166 -0
- package/lib/pages/apikey-view/apikey-view.scss +340 -0
- package/lib/pages/apikey-view/connector.js +31 -0
- package/lib/pages/apikey-view/index.js +9 -0
- package/lib/pages/chart-view/chart-view.js +92 -0
- package/lib/pages/chart-view/chart-view.scss +35 -0
- package/lib/pages/chart-view/chart-view.test.js +206 -0
- package/lib/pages/chart-view/connector.js +30 -0
- package/lib/pages/chart-view/index.js +9 -0
- package/lib/pages/dataset-detail-view/connector.js +38 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view-connector.test.js +42 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view.js +99 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view.scss +190 -0
- package/lib/pages/dataset-detail-view/dataset-detail-view.test.js +305 -0
- package/lib/pages/dataset-detail-view/index.js +9 -0
- package/lib/pages/dataset-list-view/connector.js +30 -0
- package/lib/pages/dataset-list-view/dataset-list-view.js +132 -0
- package/lib/pages/dataset-list-view/dataset-list-view.scss +242 -0
- package/lib/pages/dataset-list-view/dataset-list-view.test.js +162 -0
- package/lib/pages/dataset-list-view/index.js +9 -0
- package/lib/pages/dataset-view/connector.js +55 -0
- package/lib/pages/dataset-view/dataset-view-connector.test.js +78 -0
- package/lib/pages/dataset-view/dataset-view.js +175 -0
- package/lib/pages/dataset-view/dataset-view.scss +95 -0
- package/lib/pages/dataset-view/dataset-view.test.js +157 -0
- package/lib/pages/dataset-view/index.js +9 -0
- package/lib/pages/login-view/connector.js +25 -0
- package/lib/pages/login-view/index.js +9 -0
- package/lib/pages/login-view/login-view.js +83 -0
- package/lib/pages/login-view/login-view.scss +62 -0
- package/lib/pages/login-view/login-view.test.js +23 -0
- package/lib/pages/oauth-error-view/index.js +9 -0
- package/lib/pages/oauth-error-view/oauth-error-view.js +25 -0
- package/lib/pages/oauth-error-view/oauth-error-view.scss +13 -0
- package/lib/pages/oauth-error-view/oauth-error-view.test.js +13 -0
- package/lib/pages/oauth-view/connector.js +22 -0
- package/lib/pages/oauth-view/index.js +9 -0
- package/lib/pages/oauth-view/oauth-view.js +124 -0
- package/lib/pages/oauth-view/oauth-view.scss +7 -0
- package/lib/pages/oauth-view/oauth-view.test.js +195 -0
- package/lib/pages/query-view/connector.js +40 -0
- package/lib/pages/query-view/index.js +9 -0
- package/lib/pages/query-view/query-view.js +80 -0
- package/lib/pages/query-view/query-view.scss +39 -0
- package/lib/pages/query-view/query-view.test.js +104 -0
- package/lib/pages/user-profile-view/connector.js +39 -0
- package/lib/pages/user-profile-view/index.js +9 -0
- package/lib/pages/user-profile-view/user-profile-view.js +154 -0
- package/lib/pages/user-profile-view/user-profile-view.scss +81 -0
- package/lib/pages/user-profile-view/user-profile-view.test.js +129 -0
- package/lib/pages/visualization-view/connector.js +52 -0
- package/lib/pages/visualization-view/index.js +9 -0
- package/lib/pages/visualization-view/visualization-view-connector.test.js +62 -0
- package/lib/pages/visualization-view/visualization-view.js +128 -0
- package/lib/pages/visualization-view/visualization-view.scss +115 -0
- package/lib/pages/visualization-view/visualization-view.test.js +188 -0
- package/lib/routes.js +18 -0
- package/lib/search-params/search-params-manager.js +171 -0
- package/lib/search-params/search-params-manager.test.js +490 -0
- package/lib/store/actions.js +428 -0
- package/lib/store/dataset-selectors.js +47 -0
- package/lib/store/dataset-selectors.test.js +154 -0
- package/lib/store/query-selectors.js +53 -0
- package/lib/store/query-selectors.test.js +153 -0
- package/lib/store/reducers/index.js +20 -0
- package/lib/store/reducers/query-reducer.js +52 -0
- package/lib/store/reducers/query-reducer.test.js +89 -0
- package/lib/store/reducers/reducers.js +196 -0
- package/lib/store/reducers/reducers.test.js +309 -0
- package/lib/store/reducers/visualization-reducer.js +167 -0
- package/lib/store/reducers/visualization-reducer.test.js +426 -0
- package/lib/store/sagas/api-invoker.js +79 -0
- package/lib/store/sagas/api-invoker.test.js +139 -0
- package/lib/store/sagas/apiKey-saga.js +81 -0
- package/lib/store/sagas/apiKey-saga.test.js +57 -0
- package/lib/store/sagas/dataset-download-saga.js +43 -0
- package/lib/store/sagas/dataset-list-saga.js +49 -0
- package/lib/store/sagas/dataset-list-saga.test.js +72 -0
- package/lib/store/sagas/dataset-preview-saga.js +44 -0
- package/lib/store/sagas/dataset-query-saga.js +43 -0
- package/lib/store/sagas/dataset-recommendation-saga.js +40 -0
- package/lib/store/sagas/dataset-saga.js +50 -0
- package/lib/store/sagas/freestyle-query-saga.js +127 -0
- package/lib/store/sagas/freestyle-query-saga.test.js +145 -0
- package/lib/store/sagas/index.js +44 -0
- package/lib/store/sagas/login-saga.js +85 -0
- package/lib/store/sagas/login-saga.test.js +84 -0
- package/lib/store/sagas/logout-saga.js +96 -0
- package/lib/store/sagas/oauth-saga.js +78 -0
- package/lib/store/sagas/oauth-saga.test.js +51 -0
- package/lib/store/sagas/process-login-saga.js +62 -0
- package/lib/store/sagas/process-login-saga.test.js +83 -0
- package/lib/store/sagas/visualization-saga.js +371 -0
- package/lib/store/sagas/visualization-saga.test.js +388 -0
- package/lib/store/selectors.js +83 -0
- package/lib/store/visualization-selectors.js +85 -0
- package/lib/store/visualization-selectors.test.js +195 -0
- package/lib/styles/mixins.scss +117 -0
- package/lib/styles/variables.scss +41 -0
- package/lib/utils/file-type-utils.js +18 -0
- package/lib/utils/file-type-utils.test.js +29 -0
- package/lib/utils/geojson-utils.js +70 -0
- package/lib/utils/geojson-utils.test.js +129 -0
- package/lib/utils/http-clients.js +218 -0
- package/lib/utils/http-clients.test.js +88 -0
- package/lib/utils/index.js +34 -0
- package/lib/utils/modified-date-string-builder.js +29 -0
- package/lib/utils/modified-date-string-builder.test.js +93 -0
- package/lib/utils/query-string-builder.js +38 -0
- package/lib/utils/query-string-builder.test.js +33 -0
- package/lib/utils/recommendation-utils.js +12 -0
- package/lib/utils/recommendation-utils.test.js +9 -0
- package/package.json +172 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VS theme by Andrew Lock (https://andrewlock.net)
|
|
3
|
+
* Inspired by Visual Studio syntax coloring
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
code[class*="language-"],
|
|
7
|
+
pre[class*="language-"] {
|
|
8
|
+
color: #393A34;
|
|
9
|
+
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
|
|
10
|
+
direction: ltr;
|
|
11
|
+
text-align: left;
|
|
12
|
+
white-space: pre;
|
|
13
|
+
word-spacing: normal;
|
|
14
|
+
word-break: normal;
|
|
15
|
+
font-size: .9em;
|
|
16
|
+
line-height: 1.2em;
|
|
17
|
+
|
|
18
|
+
-moz-tab-size: 4;
|
|
19
|
+
-o-tab-size: 4;
|
|
20
|
+
tab-size: 4;
|
|
21
|
+
|
|
22
|
+
-webkit-hyphens: none;
|
|
23
|
+
-moz-hyphens: none;
|
|
24
|
+
-ms-hyphens: none;
|
|
25
|
+
hyphens: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pre>code[class*="language-"] {
|
|
29
|
+
font-size: 1em;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pre[class*="language-"]::-moz-selection,
|
|
33
|
+
pre[class*="language-"] ::-moz-selection,
|
|
34
|
+
code[class*="language-"]::-moz-selection,
|
|
35
|
+
code[class*="language-"] ::-moz-selection {
|
|
36
|
+
background: #C1DEF1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pre[class*="language-"]::selection,
|
|
40
|
+
pre[class*="language-"] ::selection,
|
|
41
|
+
code[class*="language-"]::selection,
|
|
42
|
+
code[class*="language-"] ::selection {
|
|
43
|
+
background: #C1DEF1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Code blocks */
|
|
47
|
+
pre[class*="language-"] {
|
|
48
|
+
padding: 1em;
|
|
49
|
+
margin: .5em 0;
|
|
50
|
+
overflow: auto;
|
|
51
|
+
border: 1px solid #dddddd;
|
|
52
|
+
background-color: white;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Inline code */
|
|
56
|
+
:not(pre)>code[class*="language-"] {
|
|
57
|
+
padding: .2em;
|
|
58
|
+
padding-top: 1px;
|
|
59
|
+
padding-bottom: 1px;
|
|
60
|
+
background: #f8f8f8;
|
|
61
|
+
border: 1px solid #dddddd;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.token.comment,
|
|
65
|
+
.token.prolog,
|
|
66
|
+
.token.doctype,
|
|
67
|
+
.token.cdata {
|
|
68
|
+
color: #158655;
|
|
69
|
+
font-style: italic;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.token.namespace {
|
|
73
|
+
opacity: .7;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.token.string {
|
|
77
|
+
color: #A31515;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.token.punctuation,
|
|
81
|
+
.token.operator {
|
|
82
|
+
color: #393A34;
|
|
83
|
+
/* no highlight */
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.token.url,
|
|
87
|
+
.token.symbol,
|
|
88
|
+
.token.number,
|
|
89
|
+
.token.boolean,
|
|
90
|
+
.token.variable,
|
|
91
|
+
.token.constant,
|
|
92
|
+
.token.inserted {
|
|
93
|
+
color: #0000ff;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.token.atrule,
|
|
97
|
+
.token.keyword,
|
|
98
|
+
.token.attr-value,
|
|
99
|
+
.language-autohotkey .token.selector,
|
|
100
|
+
.language-json .token.boolean,
|
|
101
|
+
.language-json .token.number,
|
|
102
|
+
code[class*="language-css"] {
|
|
103
|
+
color: #0000ff;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.token.function {
|
|
107
|
+
color: #393A34;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.token.deleted,
|
|
111
|
+
.language-autohotkey .token.tag {
|
|
112
|
+
color: #9a050f;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.token.selector,
|
|
116
|
+
.language-autohotkey .token.keyword {
|
|
117
|
+
color: #00009f;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.token.important {
|
|
121
|
+
color: #e90;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.token.important,
|
|
125
|
+
.token.bold {
|
|
126
|
+
font-weight: bold;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.token.italic {
|
|
130
|
+
font-style: italic;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.token.class-name,
|
|
134
|
+
.language-json .token.property {
|
|
135
|
+
color: #00009f;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.token.tag,
|
|
139
|
+
.token.selector {
|
|
140
|
+
color: #800000;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.token.attr-name,
|
|
144
|
+
.token.property,
|
|
145
|
+
.token.regex,
|
|
146
|
+
.token.entity {
|
|
147
|
+
color: #ff0000;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.token.directive.tag .tag {
|
|
151
|
+
background: #ffff00;
|
|
152
|
+
color: #393A34;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* overrides color-values for the Line Numbers plugin
|
|
156
|
+
* http://prismjs.com/plugins/line-numbers/
|
|
157
|
+
*/
|
|
158
|
+
.line-numbers.line-numbers .line-numbers-rows {
|
|
159
|
+
border-right-color: #a5a5a5;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.line-numbers .line-numbers-rows>span:before {
|
|
163
|
+
color: #00009f;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/* overrides color-values for the Line Highlight plugin
|
|
167
|
+
* http://prismjs.com/plugins/line-highlight/
|
|
168
|
+
*/
|
|
169
|
+
.line-highlight.line-highlight {
|
|
170
|
+
background: rgba(193, 222, 241, 0.2);
|
|
171
|
+
background: -webkit-linear-gradient(left, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0));
|
|
172
|
+
background: linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0));
|
|
173
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactSimpleCodeEditor = _interopRequireDefault(require("react-simple-code-editor"));
|
|
10
|
+
var _prismCore = require("prismjs/components/prism-core");
|
|
11
|
+
require("prismjs/components/prism-sql");
|
|
12
|
+
require("./code-editor.css");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
21
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
22
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
24
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
25
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
26
|
+
var code = 'SELECT * FROM ...';
|
|
27
|
+
var CodeEditor = /*#__PURE__*/function (_React$Component) {
|
|
28
|
+
function CodeEditor(props) {
|
|
29
|
+
var _this;
|
|
30
|
+
_classCallCheck(this, CodeEditor);
|
|
31
|
+
_this = _callSuper(this, CodeEditor, [props]);
|
|
32
|
+
_this.state = {
|
|
33
|
+
code: props.code || code
|
|
34
|
+
};
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
_inherits(CodeEditor, _React$Component);
|
|
38
|
+
return _createClass(CodeEditor, [{
|
|
39
|
+
key: "render",
|
|
40
|
+
value: function render() {
|
|
41
|
+
var _this2 = this;
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_reactSimpleCodeEditor.default, {
|
|
43
|
+
value: this.state.code,
|
|
44
|
+
onValueChange: function onValueChange(code) {
|
|
45
|
+
return _this2.setState({
|
|
46
|
+
code: code
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
highlight: function highlight(code) {
|
|
50
|
+
return (0, _prismCore.highlight)(code, _prismCore.languages.sql);
|
|
51
|
+
},
|
|
52
|
+
padding: 10,
|
|
53
|
+
onBlur: this.props.onBlur,
|
|
54
|
+
style: {
|
|
55
|
+
fontFamily: '"Fira code", "Fira Mono", monospace',
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
border: '1px black solid'
|
|
58
|
+
},
|
|
59
|
+
textareaId: "code-editor"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
}(_react.default.Component);
|
|
64
|
+
var _default = exports.default = CodeEditor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _codeEditor = _interopRequireDefault(require("./code-editor"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _codeEditor.default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("./collapsable-box.scss");
|
|
9
|
+
var _variables = _interopRequireDefault(require("../../styles/variables.scss"));
|
|
10
|
+
var _reactCollapse = require("react-collapse");
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _detailToggleIcon = _interopRequireDefault(require("../detail-toggle-icon"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
15
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
16
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
21
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
22
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
24
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
25
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
26
|
+
var _default = exports.default = /*#__PURE__*/function (_Component) {
|
|
27
|
+
function _default(props) {
|
|
28
|
+
var _this;
|
|
29
|
+
_classCallCheck(this, _default);
|
|
30
|
+
_this = _callSuper(this, _default, [props]);
|
|
31
|
+
var isDesktop = window.matchMedia(_variables.default.aboveMaxBreak).matches;
|
|
32
|
+
_this.state = {
|
|
33
|
+
expanded: isDesktop || props.expanded
|
|
34
|
+
};
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
_inherits(_default, _Component);
|
|
38
|
+
return _createClass(_default, [{
|
|
39
|
+
key: "toggleCollapsed",
|
|
40
|
+
value: function toggleCollapsed() {
|
|
41
|
+
this.setState({
|
|
42
|
+
expanded: !this.state.expanded
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "headerOpenClass",
|
|
47
|
+
value: function headerOpenClass() {
|
|
48
|
+
return this.state.expanded ? 'open' : '';
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "render",
|
|
52
|
+
value: function render() {
|
|
53
|
+
var _this2 = this;
|
|
54
|
+
return /*#__PURE__*/React.createElement("collapsable-box", null, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
"data-testid": this.props.testId,
|
|
56
|
+
className: "header-container ".concat(this.headerOpenClass()),
|
|
57
|
+
onClick: function onClick(e) {
|
|
58
|
+
_this2.toggleCollapsed();
|
|
59
|
+
},
|
|
60
|
+
onKeyDown: function onKeyDown(event) {
|
|
61
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
62
|
+
event.preventDefault();
|
|
63
|
+
_this2.toggleCollapsed();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
role: "button",
|
|
67
|
+
tabIndex: "0",
|
|
68
|
+
"aria-label": "".concat(this.props.title, " collapsable box"),
|
|
69
|
+
"aria-pressed": this.state.expanded
|
|
70
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
className: "header-text-items"
|
|
72
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "title"
|
|
74
|
+
}, this.props.title), this.props.headerHtml), /*#__PURE__*/React.createElement(_detailToggleIcon.default, {
|
|
75
|
+
expanded: this.state.expanded
|
|
76
|
+
})), /*#__PURE__*/React.createElement(_reactCollapse.Collapse, {
|
|
77
|
+
isOpened: this.state.expanded
|
|
78
|
+
}, this.props.children));
|
|
79
|
+
}
|
|
80
|
+
}]);
|
|
81
|
+
}(_react.Component);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@import '../../styles/mixins.scss';
|
|
2
|
+
@import '../../styles/variables.scss';
|
|
3
|
+
|
|
4
|
+
collapsable-box {
|
|
5
|
+
@include custom-element();
|
|
6
|
+
|
|
7
|
+
border: 1px solid $light-grey;
|
|
8
|
+
width: 100%;
|
|
9
|
+
margin-top: 2.5rem;
|
|
10
|
+
|
|
11
|
+
.header-container {
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.header-container.open {
|
|
18
|
+
border-bottom: $light-grey solid 1px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.header-container:hover {
|
|
22
|
+
background-color: $super-light-grey;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.header-text-items {
|
|
26
|
+
margin: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.title {
|
|
30
|
+
@include header();
|
|
31
|
+
font-size: 1.4em;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.collapse-icon {
|
|
35
|
+
font-size: 30px;
|
|
36
|
+
color: $dark-grey;
|
|
37
|
+
margin: 10px 10px 0 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { shallow } from 'enzyme'
|
|
2
|
+
import CollapsableBox from './collapsable-box'
|
|
3
|
+
|
|
4
|
+
describe('CollapsableBox ', () => {
|
|
5
|
+
test('desktop default to expanded', () => {
|
|
6
|
+
const matchMedia = jest.fn()
|
|
7
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
8
|
+
writable: true,
|
|
9
|
+
value: jest.fn().mockImplementation(query => ({
|
|
10
|
+
matches: true
|
|
11
|
+
}))
|
|
12
|
+
})
|
|
13
|
+
const subject = shallow(
|
|
14
|
+
<CollapsableBox headerHtml='<div />'>
|
|
15
|
+
<div />
|
|
16
|
+
</CollapsableBox>
|
|
17
|
+
)
|
|
18
|
+
expect(subject.state('expanded')).toEqual(true)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('mobile/table default to collapsed', () => {
|
|
22
|
+
const matchMedia = jest.fn()
|
|
23
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
24
|
+
writable: true,
|
|
25
|
+
value: jest.fn().mockImplementation(query => ({
|
|
26
|
+
matches: false
|
|
27
|
+
}))
|
|
28
|
+
})
|
|
29
|
+
const subject = shallow(
|
|
30
|
+
<CollapsableBox headerHtml='<div />'>
|
|
31
|
+
<div />
|
|
32
|
+
</CollapsableBox>
|
|
33
|
+
)
|
|
34
|
+
expect(subject.state('expanded')).toEqual(undefined)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('clicking the header changes the expanded state on mobile/tablet', () => {
|
|
38
|
+
const matchMedia = jest.fn()
|
|
39
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
40
|
+
writable: true,
|
|
41
|
+
value: jest.fn().mockImplementation(query => ({
|
|
42
|
+
matches: false
|
|
43
|
+
}))
|
|
44
|
+
})
|
|
45
|
+
const subject = shallow(
|
|
46
|
+
<CollapsableBox headerHtml='<div />' expanded={false}>
|
|
47
|
+
<div />
|
|
48
|
+
</CollapsableBox>
|
|
49
|
+
)
|
|
50
|
+
subject.find('.header-container').simulate('click')
|
|
51
|
+
expect(subject.state('expanded')).toEqual(true)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('clicking the header changes the expanded state on Desktop', () => {
|
|
55
|
+
const matchMedia = jest.fn()
|
|
56
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
57
|
+
writable: true,
|
|
58
|
+
value: jest.fn().mockImplementation(query => ({
|
|
59
|
+
matches: true
|
|
60
|
+
}))
|
|
61
|
+
})
|
|
62
|
+
const subject = shallow(
|
|
63
|
+
<CollapsableBox headerHtml='<div />' expanded={false}>
|
|
64
|
+
<div />
|
|
65
|
+
</CollapsableBox>
|
|
66
|
+
)
|
|
67
|
+
subject.find('.header-container').simulate('click')
|
|
68
|
+
expect(subject.state('expanded')).toEqual(false)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('clicking the header changes the expanded state on expanded', () => {
|
|
72
|
+
const matchMedia = jest.fn()
|
|
73
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
74
|
+
writable: true,
|
|
75
|
+
value: jest.fn().mockImplementation(query => ({
|
|
76
|
+
matches: undefined
|
|
77
|
+
}))
|
|
78
|
+
})
|
|
79
|
+
const subject = shallow(
|
|
80
|
+
<CollapsableBox headerHtml='<div />' expanded>
|
|
81
|
+
<div />
|
|
82
|
+
</CollapsableBox>
|
|
83
|
+
)
|
|
84
|
+
subject.find('.header-container').simulate('click')
|
|
85
|
+
expect(subject.state('expanded')).toEqual(false)
|
|
86
|
+
})
|
|
87
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _collapsableBox = _interopRequireDefault(require("./collapsable-box"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
var _default = exports.default = _collapsableBox.default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("./data-card.scss");
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
var _reactSanitizedHtml = _interopRequireDefault(require("react-sanitized-html"));
|
|
10
|
+
var _reactImageFallback = _interopRequireDefault(require("react-image-fallback"));
|
|
11
|
+
var _no_image = _interopRequireDefault(require("../../assets/no_image.png"));
|
|
12
|
+
var _utils = require("../../utils/");
|
|
13
|
+
var _loadingElement = _interopRequireDefault(require("../../components/generic-elements/loading-element"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
var DataCard = function DataCard(props) {
|
|
16
|
+
var maxDescriptionLength = 240;
|
|
17
|
+
var fileTypes = function fileTypes(_fileTypes) {
|
|
18
|
+
return _fileTypes.map(function (fileType) {
|
|
19
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
key: fileType,
|
|
21
|
+
className: "file-type"
|
|
22
|
+
}, fileType, ' ');
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var dataset = props.dataset;
|
|
26
|
+
var truncatedDescription = truncateDescription(dataset.description, maxDescriptionLength);
|
|
27
|
+
return /*#__PURE__*/React.createElement("data-card", null, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "logo"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(_reactRouterDom.Link, {
|
|
30
|
+
to: "/dataset/".concat(dataset.organization_name, "/").concat(dataset.name)
|
|
31
|
+
}, /*#__PURE__*/React.createElement(_reactImageFallback.default, {
|
|
32
|
+
src: dataset.organization_image_url,
|
|
33
|
+
fallbackImage: _no_image.default,
|
|
34
|
+
initialImage: /*#__PURE__*/React.createElement(_loadingElement.default, null),
|
|
35
|
+
alt: "The logo for ".concat(dataset.organization_title)
|
|
36
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: "details"
|
|
38
|
+
}, /*#__PURE__*/React.createElement(_reactRouterDom.Link, {
|
|
39
|
+
className: "title",
|
|
40
|
+
to: "/dataset/".concat(dataset.organization_name, "/").concat(dataset.name)
|
|
41
|
+
}, dataset.title), /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "description"
|
|
43
|
+
}, /*#__PURE__*/React.createElement(_reactSanitizedHtml.default, {
|
|
44
|
+
allowedTags: [],
|
|
45
|
+
allowedAttributes: {},
|
|
46
|
+
html: truncatedDescription
|
|
47
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "card-metadata"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "last-modified"
|
|
51
|
+
}, dataset && _utils.ModifiedDateStringBuilder.createDateString(dataset)), /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "separator"
|
|
53
|
+
}, "\u2022"), /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "file-types"
|
|
55
|
+
}, "File Type: ", fileTypes(dataset.fileTypes), ' '))));
|
|
56
|
+
};
|
|
57
|
+
function truncateDescription(description, maxLength) {
|
|
58
|
+
if (description.length > maxLength) {
|
|
59
|
+
return "".concat(description.substring(0, maxLength), "...");
|
|
60
|
+
}
|
|
61
|
+
return description;
|
|
62
|
+
}
|
|
63
|
+
var _default = exports.default = DataCard;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
@import "../../styles/mixins.scss";
|
|
2
|
+
@import "../../styles/variables.scss";
|
|
3
|
+
$logo-width: 10rem;
|
|
4
|
+
data-card {
|
|
5
|
+
@include custom-element();
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: 1.125rem 0;
|
|
8
|
+
margin-top: 0.125rem;
|
|
9
|
+
border-bottom: 1px solid $light-grey;
|
|
10
|
+
display: flex;
|
|
11
|
+
|
|
12
|
+
img {
|
|
13
|
+
width: $logo-width;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.details {
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.title {
|
|
21
|
+
@include link();
|
|
22
|
+
@include header();
|
|
23
|
+
margin-bottom: 0.5rem;
|
|
24
|
+
color:#00AEEF;
|
|
25
|
+
font-size:1.2em;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.description {
|
|
29
|
+
width: 80%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.logo {
|
|
33
|
+
padding: 0px 30px;
|
|
34
|
+
width: $logo-width;
|
|
35
|
+
text-align: center;
|
|
36
|
+
min-width: $logo-width;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.card-metadata {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
|
|
43
|
+
div {
|
|
44
|
+
margin-top: 1.125rem;
|
|
45
|
+
margin-right: 0.5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.separator {
|
|
49
|
+
margin-left: 0.25rem;
|
|
50
|
+
margin-right: 0.25rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.file-types {
|
|
54
|
+
margin-left: 0.5rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.file-type {
|
|
58
|
+
color: $csv-green;
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
text-transform: uppercase;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media only screen and (max-width: 600px) {
|
|
65
|
+
.title {
|
|
66
|
+
font-size:18px;
|
|
67
|
+
line-height:18px;
|
|
68
|
+
margin-bottom:4px;
|
|
69
|
+
color:#00aeef;
|
|
70
|
+
}
|
|
71
|
+
.description {
|
|
72
|
+
width: 100%;
|
|
73
|
+
line-height:1.4;
|
|
74
|
+
margin-top:4px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.last-modified {
|
|
78
|
+
font-size:10px;
|
|
79
|
+
line-height: 1.4;;
|
|
80
|
+
}
|
|
81
|
+
.file-types{
|
|
82
|
+
font-size:11px;
|
|
83
|
+
line-height: 1.4;;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
loading-element {
|
|
88
|
+
margin: 0 auto;
|
|
89
|
+
padding: 0;
|
|
90
|
+
padding-top: 1rem;
|
|
91
|
+
width: 5rem;
|
|
92
|
+
}
|
|
93
|
+
}
|