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

Added a basic menu for mobile #72

Merged
merged 1 commit into from
Jan 25, 2017
Merged

Conversation

coltonb
Copy link
Collaborator

@coltonb coltonb commented Jan 25, 2017

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.

Copy link
Member

@RitwikGupta RitwikGupta left a 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!

@RitwikGupta RitwikGupta merged commit b7b8d83 into pittcsc:master Jan 25, 2017
@vonbearshark
Copy link
Contributor

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

@RitwikGupta
Copy link
Member

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)

@brlodi
Copy link
Collaborator

brlodi commented Jan 25, 2017

Yeah the hamburger menu doesn't actually work in mobile Safari

@brlodi
Copy link
Collaborator

brlodi commented Jan 25, 2017

^ we crossed comments

@brlodi
Copy link
Collaborator

brlodi commented Jan 25, 2017

Also I'm not sure testing by merging into a branch that's automatically pushed to production is a sustainable workflow @RitwikGupta

@RitwikGupta
Copy link
Member

@brlodi I came, I merged, I regretted

@brlodi
Copy link
Collaborator

brlodi commented Jan 25, 2017

Veni, insedi, paenitui

@coltonb
Copy link
Collaborator Author

coltonb commented Jan 25, 2017

I was only using chrome's device toolbar to test, my bad!

Copy link
Contributor

@vonbearshark vonbearshark left a 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>
Copy link
Contributor

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?

Copy link
Contributor

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

Copy link
Collaborator Author

@coltonb coltonb Jan 25, 2017

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about a button?

Copy link
Collaborator

Choose a reason for hiding this comment

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

screen shot 2017-01-25 at 1 38 17 pm

Safari error console is showing this after clicking on the hamburger button

Copy link
Contributor

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?

Copy link
Collaborator

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator

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
Copy link
Contributor

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
Copy link
Contributor

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");
Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to set that up, @brlodi? Ref is #25, right? I can assign you

Copy link
Collaborator

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)

Copy link
Contributor

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/

Copy link
Collaborator

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
Copy link
Contributor

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

Copy link
Collaborator Author

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%;
Copy link
Contributor

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";
Copy link
Contributor

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:

  1. Display the sidebar
  2. Change the element to having the opposite arrow (via id substitution, ideally, rather than setting .style directly)
  3. Change the element's onclick to hideSidebar

}

function hideSidebar() {
document.getElementById("sidebar").style = "";
Copy link
Contributor

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:

  1. Display the sidebar
  2. Change the element to having the opposite arrow (via id substitution, ideally, rather than setting .style directly)
  3. Change the element's onclick to displaySidebar

//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);
Copy link
Contributor

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.

@coltonb
Copy link
Collaborator Author

coltonb commented Jan 25, 2017

I'm gonna give this all a try in a few hours, thanks for the feedback @vonbearshark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants