-
Notifications
You must be signed in to change notification settings - Fork 24
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
Added a basic menu for mobile #72
Conversation
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 amazing! Great work!
Waitwait! It turns out we actually want to be able to show and hide these on Desktop, too. Also, I've got some feedback for the code itself. I'll review it now |
Actually, after merging so I could open it on my phone for real instead of Chrome dev tools, clicking the menu bar does nothing on iOS (iPhone 7) |
Yeah the hamburger menu doesn't actually work in mobile Safari |
^ we crossed comments |
Also I'm not sure testing by merging into a branch that's automatically pushed to production is a sustainable workflow @RitwikGupta |
@brlodi I came, I merged, I regretted |
Veni, insedi, paenitui |
I was only using chrome's device toolbar to test, my bad! |
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.
Added some Review, but we can keep working back and forth on this
</ul> | ||
</div> | ||
</div> | ||
<div id="mobileMenuIcon"></div> |
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.
Am I crazy or is this one space off to the right?
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.
It turns out we want to expand/contract on desktop, too, so we want to show this either way, and we should avoid the mobile
terminology/design.
Instead of a hamburger icon, maybe we could have a small right-pointing arrow that expands onclick and turns into a left-pointing arrow in the top right corner of the UI that contracts onclick.
Also, it seems broken on some mobile browsers, and at least for me the hide
is never shown on the UI after the icon is clicked
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 believe the brokenness on iOS comes from some weird issue where it doesn't register click events on tags that don't typically have them, i.e. a div. I'm going to use an <a href="#">
instead, should hopefully fix the issue.
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.
How about a button
?
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.
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 was going to suggest trying to set #sidebar
or something to display:none
, but can you not set display
on Safari?
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 believe it's reporting document.getElementById().style
as a readonly property, since it's a JS error.
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.
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 suspect that's indeed the issue.
/*For Desktop*/ | ||
@media only screen and (min-width: 800px) | ||
{ | ||
#mobileMenuIcon |
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.
We want to show on the desktop, too, so we can show it regardless
@@ -94,15 +94,56 @@ footer | |||
background-color: #061428; | |||
} | |||
|
|||
#sidebar | |||
#mobileMenuIcon |
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.
Again, we should call this something different since we want it on desktop, too. Maybe expandIcon
and/or contractIcon
, expandContractIcon
, etc.
width: 48px; | ||
height: 48px; | ||
z-index: 9999; | ||
background: url("assets/mobile-ui/mobilemenu.png"); |
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.
We might want to use fontawesome (http://fontawesome.io/icons/) for this. Some overhead, but we might need them for other parts of the UI. Maybe we can just pull them as we need them, or point this URL to a remote endpoint
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.
Sounds good, just threw something together and didn't want to violate copywrite law haha.
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.
@vonbearshark The pin iconography is actually from an icon font too, so if we do go the icon font route we'd be pretty well set up for divIcon
pins in future.
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.
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.
You can assign me, but there's some discussion to be had about which icon font to use (FontAwesome actually has very limited relevant iconography, which I know because I started there when building the pin assets)
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.
Could we use fontello to bundle only the ones we need? http://fontello.com/
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.
Oh god I'm going to be lost in the Fontello rabbit hole forever now. (yes)
background: url("assets/mobile-ui/mobilemenu.png"); | ||
} | ||
|
||
#mobileHideMenu |
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 never seems to show up for me? Either way, we should have arrows instead, and probably use the same element for both maybe a #toggleExpandContact
div that can be given/taken away the #expandIcon
/#contractIcon
id
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.
There's no explicit button as I'm using the grayed out area as the return button for now, but will do.
width: 250px; | ||
height: 500px; | ||
width: 65%; | ||
height: 100%; |
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.
Like this change a lot
@@ -55,11 +55,28 @@ | |||
}); | |||
} | |||
|
|||
//Displays and hides the sidebar for mobile | |||
function displaySidebar() { | |||
document.getElementById("sidebar").style = "display:block"; |
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.
since we're converting this to being one element that simply changes the direction of the arrow, we need to:
- Display the sidebar
- Change the element to having the opposite arrow (via
id
substitution, ideally, rather than setting.style
directly) - Change the element's
onclick
tohideSidebar
} | ||
|
||
function hideSidebar() { | ||
document.getElementById("sidebar").style = ""; |
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.
since we're converting this to being one element that simply changes the direction of the arrow, we need to:
- Display the sidebar
- Change the element to having the opposite arrow (via
id
substitution, ideally, rather than setting.style
directly) - Change the element's
onclick
todisplaySidebar
//Add listeners for radio buttons | ||
document.getElementById("radioDay").addEventListener("click", displayPastDay); | ||
document.getElementById("radioWeek").addEventListener("click", displayPastWeek); | ||
document.getElementById("radioMonth").addEventListener("click", displayPastMonth); | ||
|
||
//Listeners for mobile menu | ||
document.getElementById("mobileMenuIcon").addEventListener("click", displaySidebar); | ||
document.getElementById("mobileHideMenu").addEventListener("click", hideSidebar); |
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.
If mobile, should start hidden and click should display, otherwise should start shown and click should hide. Need to check for that and set all that up, depending.
I'm gonna give this all a try in a few hours, thanks for the feedback @vonbearshark |
To try and alleviate the issue presented in #66, I added simple show/hide menu js functions, added a mobile menu icon, and added CSS rules to properly display based on whether the user is on mobile or desktop.