-
Notifications
You must be signed in to change notification settings - Fork 77
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
Layers browser width calculated based on map width #430
Conversation
Does this work with browser resizing too as media queries does? |
src/util/mapResize.js
Outdated
@@ -0,0 +1,33 @@ | |||
// set the map menu to the correct size |
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.
What is this file for?
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.
Whoops forgot to remove that. I ended up not using it.
Yes, as long as the map size changes then the menu will adjust its size. |
I am curious. Does the map have to resize for it to take effect? Would it work as expected on smaller screens? |
Awesome!!! 🎉 |
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 gorgeous! Thanks a ton! I think it needs a rebase but otherwise this is good to go!
d1d7937
to
541d225
Compare
Fixes #420 (<=== Add issue number here)
I've reformatted the styling of the menus as they shrink down in size so that the menu style applied is calculated based on the size of the map itself, not the browser window. This is done by dynamically adding a class to the
.leaflet-container
Width 0-379px gets "xs"
width 380-589px gets "sm"
width 590-879px gets "md"
width 880+ gets "lg"
Unfortunately the width of the menu itself is a set width for each of the classes, as using a % width doesn't work correctly and it would take me more time to figure out a solution. But I think this offers a pretty reasonable experience at any map width!
lg
md
sm
xs
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!