Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix mobile layout issues - forward footer ref - fix vh calculation styles

Jason Kent322a046594a3
diff --git a/web/css/events.css b/web/css/events.css
index 5f704dd75..b054f8b47 100644
--- a/web/css/events.css
+++ b/web/css/events.css
@@ -8,7 +8,6 @@
}
.event-container {
-
background: #333;
.no-events {
text-align: center;
@@ -19,7 +18,7 @@
}
min-height: 166px;
@media (max-width: 768px) {
- height: calc(100vh - 36px);
+ height: calc(var(--vh, 1vh) * 100 - 36px);
}
.event-scroll-list {
border-top: 1px solid #666;
@@ -27,7 +26,7 @@
background: #222;
min-height: 260px;
@media (max-width: 768px) {
- min-height: calc(100vh - 140px);
+ min-height: calc(var(--vh, 1vh) * 100 - 140px);
}
}
}
diff --git a/web/css/sidebar.css b/web/css/sidebar.css
index 2cab6ef88..1a42a07cd 100644
--- a/web/css/sidebar.css
+++ b/web/css/sidebar.css
@@ -417,7 +417,7 @@ footer .compare-toggle-button {
@media (max-width: 768px) {
left: 0;
width: 100%;
- height: 100vh;
+ height: calc(var(--vh, 1vh) * 100);
margin: 0;
border-radius: 0;
.modal-content, .modal-body, .modal-header, .modal-footer {
@@ -429,7 +429,7 @@ footer .compare-toggle-button {
display: flex;
flex-direction: column;
justify-content: space-between;
- max-height: calc(100vh - 2px);
+ max-height: calc(var(--vh, 1vh) * 100 - 2px);
height: 100%;
}
}
diff --git a/web/js/components/about/about-page.js b/web/js/components/about/about-page.js
index e4c860522..ddb9f6927 100644
--- a/web/js/components/about/about-page.js
+++ b/web/js/components/about/about-page.js
@@ -4,7 +4,7 @@ import Scrollbar from '../util/scrollbar';
export default function AboutPage() {
return (
- <Scrollbar style={{ height: 'calc(100vh - 200px)' }}>
+ <Scrollbar style={{ height: 'calc(var(--vh, 1vh) * 100 - 200px)' }}>
<div className="about-page">
<div className="right">
<div className="caption">
diff --git a/web/js/containers/sidebar/footer-content.js b/web/js/containers/sidebar/footer-content.js
index 85a10a933..a38e46f13 100644
--- a/web/js/containers/sidebar/footer-content.js
+++ b/web/js/containers/sidebar/footer-content.js
@@ -9,7 +9,7 @@ import SearchUiProvider from '../../components/layer/product-picker/search-ui-pr
import { openCustomContent } from '../../modules/modal/actions';
import { stop as stopAnimationAction } from '../../modules/animation/actions';
-const FooterContent = (props) => {
+const FooterContent = React.forwardRef((props, ref) => {
const {
isCompareActive,
compareMode,
@@ -20,13 +20,25 @@ const FooterContent = (props) => {
addLayers,
toggleCompare,
compareFeature,
- stopAnimation,
} = props;
const compareBtnText = !isCompareActive
? `Start Comparison${isMobile ? ' Mode' : ''}`
: `Exit Comparison${isMobile ? ' Mode' : ''}`;
+
+ const onClickAddLayers = (e) => {
+ e.stopPropagation();
+ addLayers(isPlaying);
+ googleTagManager.pushEvent({ event: 'add_layers' });
+ };
+
+ const onClickToggleCompare = (e) => {
+ e.stopPropagation();
+ toggleCompare();
+ googleTagManager.pushEvent({ event: 'comparison_mode' });
+ };
+
return activeTab === 'layers' ? (
- <footer>
+ <footer ref={ref}>
<ModeSelection
isActive={isCompareActive}
isMobile={isMobile}
@@ -39,35 +51,20 @@ const FooterContent = (props) => {
aria-label="Add layers"
className="layers-add red"
text="+ Add Layers"
- onClick={(e) => {
- e.stopPropagation();
- if (isPlaying) {
- stopAnimation();
- }
- addLayers();
- googleTagManager.pushEvent({
- event: 'add_layers',
- });
- }}
+ onClick={onClickAddLayers}
/>
<Button
id="compare-toggle-button"
aria-label={compareBtnText}
className="compare-toggle-button"
style={!compareFeature ? { display: 'none' } : null}
- onClick={(e) => {
- e.stopPropagation();
- toggleCompare();
- googleTagManager.pushEvent({
- event: 'comparison_mode',
- });
- }}
+ onClick={onClickToggleCompare}
text={compareBtnText}
/>
</div>
</footer>
) : null;
-};
+});
const mapDispatchToProps = (dispatch) => ({
toggleCompare: () => {
@@ -76,7 +73,10 @@ const mapDispatchToProps = (dispatch) => ({
changeCompareMode: (str) => {
dispatch(changeMode(str));
},
- addLayers: () => {
+ addLayers: (isPlaying) => {
+ if (isPlaying) {
+ dispatch(stopAnimationAction());
+ }
dispatch(
openCustomContent('LAYER_PICKER_COMPONENT', {
headerText: null,
@@ -87,9 +87,6 @@ const mapDispatchToProps = (dispatch) => ({
}),
);
},
- stopAnimation: () => {
- dispatch(stopAnimationAction());
- },
});
const mapStateToProps = (state) => {
@@ -110,6 +107,8 @@ const mapStateToProps = (state) => {
export default connect(
mapStateToProps,
mapDispatchToProps,
+ null,
+ { forwardRef: true },
)(FooterContent);
FooterContent.propTypes = {
@@ -121,6 +120,5 @@ FooterContent.propTypes = {
isCompareActive: PropTypes.bool,
isMobile: PropTypes.bool,
isPlaying: PropTypes.bool,
- stopAnimation: PropTypes.func,
toggleCompare: PropTypes.func,
};
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index 17fb8368e..fc61e7c41 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -343,6 +343,7 @@ class Sidebar extends React.Component {
</TabPane>
<FooterContent
+ ref={(el) => { this.footerElement = el; }}
tabTypes={tabTypes}
activeTab={activeTab}
/>