Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

flexbox for list/detail and container

Jason Kente3b4b291a6a7
diff --git a/web/css/layers.css b/web/css/layers.css
index 3f17804e3..d32a2420b 100644
--- a/web/css/layers.css
+++ b/web/css/layers.css
@@ -800,7 +800,7 @@
}
&.browse-search-width {
width: 95%;
- max-width: 1400px;
+ max-width: 1200px;
& .product-outter-list-case {
width: 100%;
padding: 0 11px 5px 0;
@@ -860,7 +860,7 @@
}
&.browse-search-width {
width: 95%;
- max-width: 1000px;
+ max-width: 1200px;
}
& .category-masonry-case {
@@ -975,21 +975,18 @@
}
}
+.search-container {
+ display: flex;
+ &.mobile {
+ flex-direction: column;
+ }
+}
+
.layer-list-container {
- float: left;
padding: 0 2px 0 5px;
-
- &.search {
- width: 40%;
- &.mobile {
- width: 100%;
- }
- }
- &.browse {
- width: 50%;
- &.mobile {
- width: 100%;
- }
+ flex-grow: 1;
+ &.search:not(.mobile) {
+ max-width: 400px;
}
}
.no-results {
@@ -1012,21 +1009,17 @@
}
.layer-detail-container {
- height: 100%;
- float: left;
padding-right: 2px;
&.search {
- width: 60%;
+ flex-grow: 1;
&.mobile {
- width: 100%;
margin-top: 10px;
padding-left: 2px;
}
}
&.browse {
- width: 50%;
-
+ flex-basis: 50%;
& h2 {
color: #eee;
font-size: 24px;
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.js
index f3ebbd280..97e91904a 100644
--- a/web/js/components/layer/product-picker/product-picker.js
+++ b/web/js/components/layer/product-picker/product-picker.js
@@ -51,6 +51,7 @@ class ProductPicker extends React.Component {
measurementSourceIndex: 0,
filteredRows: props.filteredRows,
searchResultRows: null,
+ numRowsFilteredOut: null,
inputValue: '',
filterByAvailable: true,
modalElement: null
@@ -131,6 +132,7 @@ class ProductPicker extends React.Component {
newState = {
filteredRows,
searchResultRows,
+ numRowsFilteredOut: searchResultRows.length - filteredRows.length,
listType: 'search',
inputValue: value,
selectedLayer: newSelectedLayer
@@ -270,7 +272,7 @@ class ProductPicker extends React.Component {
renderLayerList() {
const {
filteredRows,
- searchResultRows,
+ numRowsFilteredOut,
listType,
categoryType,
category,
@@ -298,6 +300,7 @@ class ProductPicker extends React.Component {
? height / 2
: height
: height;
+ const containerClass = isMobile ? 'search-container mobile' : 'search-container';
const listContainerClass = isSearching
? isMobile
? 'layer-list-container search mobile'
@@ -306,8 +309,6 @@ class ProductPicker extends React.Component {
? 'layer-list-container browse mobile'
: 'layer-list-container browse';
- const numRowsFilteredOut = isSearching && searchResultRows.length - filteredRows.length;
-
return filteredRows.length || !isSearching ? (
<>
{ isSearching &&
@@ -319,50 +320,52 @@ class ProductPicker extends React.Component {
}
</div>
}
- <div className={listContainerClass}>
- <Scrollbars style={{ maxHeight: listHeight + 'px' }}>
- <div className="product-outter-list-case">
- <LayerList
- isMobile={isMobile}
- addLayer={addLayer}
- removeLayer={removeLayer}
- activeLayers={activeLayers}
- layerConfig={layerConfig}
- listType={listType}
- category={category}
- categoryConfig={categoryConfig[categoryType]}
- selectedProjection={selectedProjection}
- selectedDate={selectedDate}
- selectedLayer={selectedLayer}
- filteredRows={filteredRows}
- hasMeasurementSetting={hasMeasurementSetting}
- hasMeasurementSource={hasMeasurementSource}
- measurementConfig={measurementConfig}
- selectedMeasurement={selectedMeasurement}
- updateSelectedMeasurement={this.updateSelectedMeasurement.bind(this)}
- showMetadataForLayer={layer => this.showMetadataForLayer(layer)}
- setSourceIndex={index => this.setSourceIndex(index)}
- currentMeasureSource={this.getCurrentMeasureSource()}
- />
- </div>
- </Scrollbars>
+ <div className={containerClass}>
+ <div className={listContainerClass}>
+ <Scrollbars style={{ maxHeight: listHeight + 'px' }}>
+ <div className="product-outter-list-case">
+ <LayerList
+ isMobile={isMobile}
+ addLayer={addLayer}
+ removeLayer={removeLayer}
+ activeLayers={activeLayers}
+ layerConfig={layerConfig}
+ listType={listType}
+ category={category}
+ categoryConfig={categoryConfig[categoryType]}
+ selectedProjection={selectedProjection}
+ selectedDate={selectedDate}
+ selectedLayer={selectedLayer}
+ filteredRows={filteredRows}
+ hasMeasurementSetting={hasMeasurementSetting}
+ hasMeasurementSource={hasMeasurementSource}
+ measurementConfig={measurementConfig}
+ selectedMeasurement={selectedMeasurement}
+ updateSelectedMeasurement={this.updateSelectedMeasurement.bind(this)}
+ showMetadataForLayer={layer => this.showMetadataForLayer(layer)}
+ setSourceIndex={index => this.setSourceIndex(index)}
+ currentMeasureSource={this.getCurrentMeasureSource()}
+ />
+ </div>
+ </Scrollbars>
+ </div>
+ { this.renderDetails(listHeight) }
</div>
- { this.renderDetails(listHeight) }
- </>
- ) : (
- <div className="no-results">
- <i className="fas fa-5x fa-meteor"></i>
- <h3> No layers found! </h3>
- {numRowsFilteredOut > 0 &&
+ </>)
+ : (
+ <div className="no-results">
+ <i className="fas fa-5x fa-meteor"></i>
+ <h3> No layers found! </h3>
+ {numRowsFilteredOut > 0 &&
<p>
{numRowsFilteredOut} result(s) are being filtered out.
<a className="remove-filters" onClick={this.toggleFilterByAvailable.bind(this)}>
Remove filters?
</a>
</p>
- }
- </div>
- );
+ }
+ </div>
+ );
}
renderDetails(listHeight) {