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
Add fullscreen option to map #1655
Add fullscreen option to map #1655
Conversation
66dbd19
to
1896c34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is lovely 🍇 On the other hand, I've potentially asked you to change a lot of it ;)
@@ -869,6 +869,10 @@ $.extend(fixmystreet.set_up, { | |||
} | |||
$('#key-tools li:empty').remove(); | |||
$('#report-updates-data').insertAfter($('#map_box')); | |||
if (fixmystreet.page === 'report') { | |||
$('#sub_map_links').append('<a href="#" id="show-fullscreen" class="expand">Expand map</span>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need internationalizing, see how other strings do it elsewhere :)
web/cobrands/sass/_base.scss
Outdated
@@ -1496,6 +1497,48 @@ html.js #map .noscript { | |||
background-image:url($image-sprite); | |||
background-position: flip(right, -341px) -3936px; | |||
} | |||
&.expand { | |||
padding: 0.6em 1em 0.5em 1em; | |||
&:after { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not saying this is wrong, but why is this done differently to the other sub map link icons, with an :after
, and not just an immediate background-image?
Also, note how the other icons do their positioning - you need to account for the LTR/RTL possibility (where you'd want the icon on the right in RTL).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was wrestling with this for a while this morning (my CSS-fu is weak), and @zarino suggested doing it this way, as positioning relative to the right hand side is tricky to do with background-position
. I think it's easier with the others as they use a sprite, but I decided to use an SVG as we seem to be moving in that direction for other stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough! Hmm, not sure the LTR/RTL code has had to deal with an after/before swap before, I'll leave that with you to try and sort ;) There are many uses of the left/right and flip() mixins that hopefully make sense. .expand
and .close
can share most of their CSS too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, my fault! Maybe we’d use the sprite more, if we had some convenience functions to automatically compile them and surface coordinates for positioning in the sass.
Re: RTL, my understanding is that the :after
pseudo element will respect RTL ordering, if it’s display: inline
or display: inline-block
– ie: in English, the pseudo-element will sit to the right of the button, in Arabic it'd sit to the left. I think.
You’d just need to make sure you use our RTL sass mixins like flip()
for any margins/padding you added.
@@ -869,6 +869,10 @@ $.extend(fixmystreet.set_up, { | |||
} | |||
$('#key-tools li:empty').remove(); | |||
$('#report-updates-data').insertAfter($('#map_box')); | |||
if (fixmystreet.page === 'report') { | |||
$('#sub_map_links').append('<a href="#" id="show-fullscreen" class="expand">Expand map</span>'); | |||
$('#sub_map_links').append('<a href="#" id="hide-fullscreen" class="compress hidden">Collapse map</span>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be nicer as one link that changes class/text when clicked, rather than two? Guess it doesn't make much difference, but I think other similar uses in the code currently toggle the one link.
web/cobrands/sass/_base.scss
Outdated
@@ -1559,7 +1602,7 @@ html.js #map .noscript { | |||
text-transform: uppercase; | |||
text-align: center; | |||
font-size: 0.875em; | |||
.mobile-reporting-map & { | |||
.mobile-reporting-map &, .report-fullscreen & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class never appears on a report page.
web/cobrands/sass/_base.scss
Outdated
@@ -1656,7 +1699,7 @@ a:hover.rap-notes-trigger { | |||
// and make the map full screen to reduce distractions. JavaScript also | |||
// tweaks the text content of some of the map-related elements, to make | |||
// it more "app-like". | |||
.mobile-reporting-map { | |||
.mobile-reporting-map, .report-fullscreen { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how these share a lot, I wonder if we can clear it up a bit to split it out a bit more. So we'd have:
- one class that shows the map full screen,
map-fullscreen
perhaps; - one class that 'locks' it, that's
only-map
; - one class that does page-specific thing, so
mobile-reporting-map
(perhaps renamed something like map-reporting?) and its pan zoom top.
Then the report page would have map-fullscreen only-map
, and the around page would have map-fullscreen only-map map-reporting
(where it currently has mobile-reporting-map only-map). Does that make sense, or not worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I like this, then if we want to use map-fullscreen
anywhere else, it makes sense, without having to add another class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, a couple of small things.
web/cobrands/sass/_base.scss
Outdated
} | ||
background-size: 16px 16px; | ||
vertical-align: middle; | ||
margin: flip(0 0 0 8px, 0 8px 0 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, just to note that if you did only want to do the one margin as originally, you could write it as:
margin-#{$left}: 8px;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaaah, shiny!
@@ -869,7 +869,7 @@ $.extend(fixmystreet.set_up, { | |||
} | |||
$('#key-tools li:empty').remove(); | |||
$('#report-updates-data').insertAfter($('#map_box')); | |||
if (fixmystreet.page === 'report') { | |||
if (['reports','report'].includes(fixmystreet.page)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includes
is much too modern, I'm afraid.
web/cobrands/sass/_base.scss
Outdated
margin: flip(0 0 0 8px, 0 8px 0 0); | ||
} | ||
} | ||
&.compress { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.expand and .compress still share most of their style, all of it apart from the image URLs could be on #toggle-fullscreen for example.
f6df291
to
664850e
Compare
664850e
to
a38b5d7
Compare
For mysociety/fixmystreetforcouncils#156
This adds a 'Show Fullscreen' option to the map on a
/report
page to make the map easier to use when on mobile: