Interactive interface for browsing global, full-resolution satellite imagery
vh fix for mobile and scrollbar styles
Jason Kentabaf9e51fa11
diff --git a/web/css/facets.css b/web/css/facets.cssindex d706fedec..f19ef5cbf 100644--- a/web/css/facets.css+++ b/web/css/facets.css@@ -32,10 +32,9 @@}}& .inner-container {- padding: 10px 12px 10px 10px;+ padding: 10px;margin: 0 4px 2px 2px;background-color: #333;- height: 100%;overflow-y: auto;}& .facet-wrapper {diff --git a/web/css/layer-categories.css b/web/css/layer-categories.cssindex a8c754669..415790eea 100644--- a/web/css/layer-categories.css+++ b/web/css/layer-categories.css@@ -1,5 +1,5 @@/* Categories view */-.layer-modal-content .categories-nav {+.categories-nav {margin: auto;max-width: 960px;padding-top: 5px;diff --git a/web/css/layers.css b/web/css/layers.cssindex b10f33e1c..d9ef1c8d6 100644--- a/web/css/layers.css+++ b/web/css/layers.css@@ -274,7 +274,7 @@width: 978px;max-width: 95%;& .layer-modal-content {- height: calc(100vh - 135px);+ height: calc(var(--vh, 1vh) * 100 - 135px);}& .modal-body {padding: 0 0 0 10px;@@ -288,7 +288,7 @@width: 98%;max-width: 1200px;& .layer-modal-content {- height: calc(100vh - 155px);+ height: calc(var(--vh, 1vh) * 100 - 155px);display: flex;flex-direction: column;}@@ -342,7 +342,7 @@.layer-list-container {overflow-y: auto;- padding: 0 2px 0 0;+ padding: 0;&.browse {border-right: 1px solid #ccc;}@@ -520,7 +520,7 @@.custom-layer-dialog.category-width {width: 658px;& .modal-body {- padding: 0 0 0 6px;+ padding: 0 0 0 8px;}}.custom-layer-dialog {@@ -562,14 +562,14 @@}&.browse-search-width .layer-modal-content {padding: 0;- height: calc(100vh - 70px);+ height: calc(var(--vh, 1vh) * 100 - 70px);}& .product-outter-list-case {width: 100%;- padding: 0 10px 0 0;+ padding: 0 6px 0 0;}}- .layer-category {+ .category-masonry-case .layer-category {width: 100%;}.category-background-cover {@@ -590,7 +590,6 @@}}.layer-detail-container.search {-border-top: 5px solid #d54e21;padding-left: 2px;background-image: linear-gradient(#aaa, #ddd 15%);diff --git a/web/css/scrollbar.css b/web/css/scrollbar.cssindex b3921a27a..f9452f7ab 100644--- a/web/css/scrollbar.css+++ b/web/css/scrollbar.css@@ -9,3 +9,22 @@border-radius: 0;opacity: 0.8;}++html {+ --scrollbarBG: #ccc;+ --thumbBG: #aaa;+}+*::-webkit-scrollbar {+ width: 10px;+}+* {+ scrollbar-width: 10px;+ scrollbar-color: var(--thumbBG) var(--scrollbarBG);+}+*::-webkit-scrollbar-track {+ background: transparent;+}+*::-webkit-scrollbar-thumb {+ background-color: var(--thumbBG);+ border-radius: 0;+}diff --git a/web/js/app.js b/web/js/app.jsindex 7371d1cb1..03a3adbe4 100644--- a/web/js/app.js+++ b/web/js/app.js@@ -67,8 +67,8 @@ import '../css/indicator.css';import '../css/events.css';import '../css/dataDownload.css';import '../css/sidebar.css';-import '../css/layers.css';import '../css/layer-categories.css';+import '../css/layers.css';import '../css/scrollbar.css';import '../css/switch.css';import '../css/timeline.css';@@ -90,16 +90,26 @@ class App extends React.Component {super(props);this.onload();this.handleKeyPress = this.handleKeyPress.bind(this);+ this.setVhCSSProperty = this.setVhCSSProperty.bind(this);}componentDidMount() {document.addEventListener('keydown', this.handleKeyPress);+ // We listen to the resize event+ window.addEventListener('resize', this.setVhCSSProperty);}componentWillUnmount() {document.removeEventListener('keydown', this.handleKeyPress);}+ // https://css-tricks.com/the-trick-to-viewport-units-on-mobile/+ setVhCSSProperty = () => {+ // We execute the same script as before+ const vh = window.innerHeight * 0.01;+ document.documentElement.style.setProperty('--vh', `${vh}px`);+ }+handleKeyPress(event) {const { keyPressAction } = this.props;const ctrlOrCmdKey = event.ctrlKey || event.metaKey;@@ -156,6 +166,7 @@ class App extends React.Component {});self.props.screenResize(window);models.wv.events.trigger('startup');+ self.setVhCSSProperty();};util.wrap(main)();}diff --git a/web/js/components/layer/product-picker/search/facets.js b/web/js/components/layer/product-picker/search/facets.jsindex c149ac5ec..1da18c73c 100644--- a/web/js/components/layer/product-picker/search/facets.js+++ b/web/js/components/layer/product-picker/search/facets.js@@ -22,7 +22,6 @@ function Facets(props) {} = props;const showFacets = browser.greaterThan.small || showMobileFacets;- const facetHeight = isMobile ? 'calc(100vh - 125px)' : '100%';return !showFacets ? null : (<div className="facet-container">@@ -33,7 +32,7 @@ function Facets(props) {facetConfig={facetConfig}/>- <div className="inner-container" style={{ height: facetHeight, overflowY: 'auto' }}>+ <div className="inner-container">{facetConfig.map((config) => {const facet = facets[config.field];const data = (facet && facet.length && facet[0].data) || [];