Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mobile CSS #1531

Merged
merged 9 commits into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const redux = require('redux');
const reduxLogger = require('redux-logger').logger;
const reducer = require('./reducers');

const isProduction = window.location.href.indexOf('electricitymap') !== -1;
const isProduction = window.location.href.indexOf('electricitymap') !== -1;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed space


const store = isProduction ?
redux.createStore(
Expand Down
27 changes: 10 additions & 17 deletions web/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ line, path {
}

.country-panel{
overflow-y: auto;
overflow-y: scroll;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scroll the country panel instead of the container

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this on desktop? I think there was a specific reason for scrolling the container versus the panel. I think it would be nice to redo the html structure for the panel if we have time, now it's a bit of a patchwork and the lack of consistency is making it difficult to bugfix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I tested it. I actually think it's better structured now. But let's review together

padding-right: calc(2rem - 6px);
padding-left: 2rem;
margin: 0;
-webkit-overflow-scrolling: touch;
}
.country-panel-wrap {
position: relative;
padding-top: 160px;
padding-top: 200px;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that the header is included, more padding must be applied to left panel content

}
.country-panel-wrap .bysource {
font-size: smaller;
Expand Down Expand Up @@ -276,7 +276,6 @@ body {
flex-direction: row;
align-items: stretch;
position: relative;
overflow-y: auto;
flex: 1 1 auto;
}

Expand Down Expand Up @@ -398,7 +397,7 @@ body {
.left-panel-toolbar,
.left-panel-zone-details-toolbar {
position: relative;
padding: 1rem 1.25rem 0 1.25rem;
padding: 1rem 1.25rem 1rem 1.25rem;
}
.left-panel-toolbar .left-panel-toolbar-back,
#left-panel-highscore-back {
Expand Down Expand Up @@ -429,12 +428,12 @@ body {
width: 2.875rem;
}

.mobile-info-tab, .left-panel-zone-details {
.left-panel-zone-details {
display: flex;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required for mobile "about" tab to show correctly. Not sure why there was a column flex there.

line-height: 1.2rem;
flex-direction: column;
flex: 1;
overflow: hidden;
overflow-y: hidden;
}

.mobile-info-tab {
Expand All @@ -452,11 +451,7 @@ body {
margin: 0.6rem 0;
}

.left-panel-zone-details .detail-bottom-section{
padding: 0rem 1rem 1.25rem;
}

.left-panel-zone-details .detail-bottom-section .social-buttons{
.detail-bottom-section .social-buttons{
padding: 0 1rem;
}

Expand Down Expand Up @@ -491,7 +486,7 @@ body {
.country-table-header {
position: absolute;
width:100%;
padding: 1rem 0 0.5rem 0;
padding: 0 0 0.5rem 0;
position: absolute;
left: 0;
background-color: #FAFAFA;
Expand Down Expand Up @@ -1151,8 +1146,6 @@ div.highscore-button:hover {
-moz-box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.10);
box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.10);
z-index: 2;
border-top-right-radius: 8px;
border-top-left-radius: 8px;

}
#tab-content {
Expand All @@ -1173,8 +1166,7 @@ div.highscore-button:hover {
padding-top: 8px;
font-family: "Open Sans", sans-serif;
}
#tab.nomap #tab-content .list-item.map-button,
{
#tab.nomap #tab-content .list-item.map-button {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: there was an extra comma that needed removal -_-

display: none;
}
#tab #tab-content .list-item.active {
Expand Down Expand Up @@ -1716,6 +1708,7 @@ div.highscore-button:hover {
-webkit-box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.10);
-moz-box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.10);
box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.10);
z-index: 999; /* required for the box-shadow to overlay everything */
}
#mobile-header .header-content{
display: flex;
Expand Down Expand Up @@ -1746,7 +1739,7 @@ div.highscore-button:hover {
}
.left-panel {
position: relative;
height: auto;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core of the bugfix 2/2

height: unset;
}
.left-panel, #map-container {
width: 100%;
Expand Down
83 changes: 40 additions & 43 deletions web/views/pages/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ co2Sub = function(str) {
</a>
</span>
</p>
</div>
</div>
</div>


Expand All @@ -211,7 +211,7 @@ co2Sub = function(str) {
</div>
</div>
<div class="info-text">
<%- __('panel-initial-text.thisproject') %> <a href="https://github.com/tmrowco/electricitymap-contrib" target="_blank"><%- __('panel-initial-text.opensource') %></a> (<%- __('panel-initial-text.see') %> <a href="https://github.com/tmrowco/electricitymap-contrib#data-sources" target="_blank"><%- __('panel-initial-text.datasources') %></a>). <%- __('panel-initial-text.contribute', 'https://github.com/tmrowco/electricitymap#adding-a-new-country') %>.
<%- __('panel-initial-text.thisproject') %> <a href="https://github.com/tmrowco/electricitymap-contrib" target="_blank"><%- __('panel-initial-text.opensource') %></a> (<%- __('panel-initial-text.see') %> <a href="https://github.com/tmrowco/electricitymap-contrib#data-sources" target="_blank"><%- __('panel-initial-text.datasources') %></a>). <%- __('panel-initial-text.contribute', 'https://github.com/tmrowco/electricitymap#adding-a-new-country') %>.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-indented

<p>
<%- __('footer.foundbugs') %> <a href="https://github.com/tmrowco/electricitymap-contrib/issues/new" target="_blank"><%- __('footer.here') %></a>.<br />
</p>
Expand All @@ -224,60 +224,57 @@ co2Sub = function(str) {
</p>
</div>
<div class="social-buttons large-screen-hidden">
<p>
<!-- Facebook share -->
<div class="fb-share-button"
data-href="https://www.electricitymap.org/"
data-layout="button_count">
</div>
<!-- Twitter share -->
<a class="twitter-share-button"
data-url="https://www.electricitymap.org"
data-via="electricitymap"
data-lang="<%= locale %>">
<p>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just reindent

<!-- Facebook share -->
<div class="fb-share-button"
data-href="https://www.electricitymap.org/"
data-layout="button_count">
</div>
<!-- Twitter share -->
<a class="twitter-share-button"
data-url="https://www.electricitymap.org"
data-via="electricitymap"
data-lang="<%= locale %>">
</a>
<!-- Slack -->
<span class="slack-button">
<a href="https://slack.tmrow.co" target="_blank" class="slack-btn">
<span class="slack-ico"></span>
<span class="slack-text">Slack</span>
</a>
<!-- Slack -->
<span class="slack-button">
<a href="https://slack.tmrow.co" target="_blank" class="slack-btn">
<span class="slack-ico"></span>
<span class="slack-text">Slack</span>
</a>
</span>
</p>
</span>
</p>
</div>

<div class="mobile-faq-header">
<%- __('misc.faq') %>
</div>
<div class="mobile-faq">
<%- __('misc.faq') %>
</div>
<div class="mobile-faq"></div>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved closing brace to upper line

</div>
<div class="left-panel-zone-details">

<div class="left-panel-zone-details-toolbar">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the toolbar (country name and flag) into the header (which is always visible).
Not sure why this wasn't done before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I remember this being a bit of a compromise to not have too much vertical space being taken up by fixed content, reducing the amount of info visible on smaller screens.

<span class="left-panel-back-button">
<i class="material-icons" aria-hidden="true">arrow_back</i>
</span>
<div class="country-name-time">
<div class="country-name-time-table">
<div style="display: table-cell">
<img id="country-flag" class="flag"></img>
</div>

<div style="display: table-cell">
<div class="country-name"></div>
<div class="country-time">?</div>
</div>
</div>
</div>
</div>


<div class="country-panel">
<div class="zone-details-no-parser-message">
<%- __('country-panel.noParserInfo', 'https://github.com/tmrowco/electricitymap#adding-a-new-country') %>
</div>
<div class="country-table-header">
<div class="left-panel-zone-details-toolbar">
<span class="left-panel-back-button">
<i class="material-icons" aria-hidden="true">arrow_back</i>
</span>
<div class="country-name-time">
<div class="country-name-time-table">
<div style="display: table-cell">
<img id="country-flag" class="flag"></img>
</div>

<div style="display: table-cell">
<div class="country-name"></div>
<div class="country-time">?</div>
</div>
</div>
</div>
</div>
<div class="country-table-header-inner">
<div class="country-col country-emission-intensity-wrap">
<div id="country-emission-rect" class="country-col-box emission-rect emission-rect-overview">
Expand Down