-
Notifications
You must be signed in to change notification settings - Fork 239
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
updates notification drawer to support mobile #717
updates notification drawer to support mobile #717
Conversation
…ion-drawer-mobile Close the notification drawer when showing the mobile vertical nav menu
src/less/navbar-vertical.less
Outdated
@@ -18,7 +18,7 @@ | |||
position: fixed; | |||
right: 0; | |||
top: 0; | |||
z-index: @zindex-navbar-fixed; | |||
z-index: 1035; |
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 a little concerning. Lots of the vertical-nav.less classes use @zindex-navbar-fixed as a base and add to that ( https://github.com/patternfly/patternfly/blob/master/src/less/vertical-nav.less#L293-L298 ). Adopters may also be using this to be able to show items over the navbar.
Is there sufficient reason to change this?
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.
@jeff-phillips-18 we can revert it back now that we have the hamburger menu closing the drawer. This was changed to ensure the drawer sits about the open menu but that shouldn't be a problem.
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.
@jeff-phillips-18 ok, the issue is now. If I change it back to 1030 then the menu can be open and if you open the drawer it's under the menu. Does it make sense to have the menu close if you open the drawer?
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, it should close
src/less/notifications-drawer.less
Outdated
@media (max-width: @screen-xs-max) { | ||
width:100%; | ||
height: 100vh; // override to show use full height | ||
} |
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.
Should the top value (58px) be subtracted?
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.
@jeff-phillips-18 I'll add it in, it didn't see any visible difference when I had it but it can't hurt.
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 is required for the drawer to expand/collapse correctly and still show the last group or actions/notifications if there is more than fit on the 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.
ah ok
@@ -1,6 +1,6 @@ | |||
<div class="drawer-pf hide drawer-pf-notifications-non-clickable"> | |||
<div class="drawer-pf-title"> | |||
<a class="drawer-pf-toggle-expand fa fa-angle-double-left"></a> | |||
<a class="drawer-pf-toggle-expand fa fa-angle-double-left hidden-xs"></a> | |||
<a class="drawer-pf-close pficon pficon-close"></a> |
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 don't show the expander at xs resolution but the drawer could still have the drawer-pf-expanded class (if expanded prior to shrinking the window). Is this something we should handle?
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.
@jeff-phillips-18 good question. How concerned are we with these types of scenarios. They seem unlikely to me.
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'm OK with leaving it out. The JS for this is not shipped as an available function anyhow. We'll just need to remember to handle this in the JS repos.
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.
with the change I just pushed I added in a media query to remove the left:270; that is added when expanded. It now will just take up full width. I think this is a good solution, what do you think?
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.
Agreed.
@jeff-phillips-18 I've updated this to reflect the changes requested in patternfly/angular-patternfly#576 by @benjaminapetersen. Also added the js provided. |
Relevant to web console: openshift/origin-web-console#1326 |
@@ -3,7 +3,7 @@ | |||
(function ($) { | |||
'use strict'; | |||
|
|||
$.fn.setupVerticalNavigation = function (handleItemSelections) { | |||
$.fn.setupVerticalNavigation = function (handleItemSelections, ignoreDrawer) { |
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.
Do you follow a convention when adding methods to the jQuery.prototype
? For example, I've seen elsewhere pfDonutTooltipContents
, pfPieTooltipContents
, etc.
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 realize you didn't create the function in this PR & are just modifying, but wanted to point this out just in case.
@@ -259,6 +261,15 @@ | |||
// Always start at the primary menu | |||
updateMobileMenu(); | |||
navElement.addClass('show-mobile-nav'); | |||
|
|||
// If the notification drawer is shown, hide 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.
I'd suggest breaking this out into a handleDrawer()
kind of function, rather than adding complexity to bindMenuBehavior
, but totally up to your team style guidelines.
$('.drawer-pf-trigger').removeClass('open'); | ||
$drawer.addClass('hide'); | ||
} | ||
} | ||
} | ||
} else if (navElement.hasClass('collapsed')) { | ||
window.localStorage.setItem('patternfly-navigation-primary', 'expanded'); |
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 wonder if sessionStorage
would be better for things like patternfly-navigation-primary
. Is it essential to keep this information between browser restarts? I would tend to expect it to return to default collapse
state between.
Also not part of your PR so feel free to ignore :)
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 was done specifically for an application that needs this state maintained between restarts.
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.
Hmm. possible to consider making these kinds of things configurable so that the needs of one app don't have to affect another?
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.
Sure, this seems separate from this PR though. Please file an issue and consider contributing a PR.
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, not relevant for this PR. Will do!
src/less/notifications-drawer.less
Outdated
@@ -42,7 +42,9 @@ | |||
display: block; | |||
} | |||
&.drawer-pf-expanded { | |||
left: 270px; | |||
@media (min-width: @screen-xs-max) { |
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.
Should it go full screen on mobile rather than partial? Orig comment: @bean66
Also bringing my gif back, If I expand the drawer, then shrink the page down, the drawer will go off screen (and stay off screen) as I click the toggle:
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 are looking at the horizontal example which hasn't been fixed yet, this PR started out as just for the vertical example. I am working on the horizontal and will push shortly.
@jeff-phillips-18 @benjaminapetersen |
src/less/notifications-drawer.less
Outdated
@media (max-width: @screen-xs-max) { | ||
width:100%; | ||
height: calc(~"100vh - 58px"); | ||
top:34px; // this pushed the drawer below the notification icon in the menu |
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.
Curious if the top: 34px
could be a variable that we could build off of. I know we have had conversations in the web console about having things pile up in that top left corner, once you open the drawer & have a toast or two... @rhamilto thoughts?
|
||
@media (max-width: @screen-xs-max) { | ||
width:100%; | ||
height: calc(~"100vh - 58px"); |
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'd love to see the px measurements in variables, especially since they are used multiple times and height relates to top.
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, esp if there is relationships between these values across components.
I think all of these positioning values should be variables so they can easily be overridden downstream. Otherwise entire rules have to be duplicated... |
@srambach @benjaminapetersen @rhamilto That makes a lot of sense. @LHinson should we pull @andresgalante into this when he is back? |
Thanks @srambach @rhamilto @benjaminapetersen for the reviews. After syncing with @matthewcarleton, we are in agreement with your recommendation to make the position valuables variables. I've filed two new issues for this. One for the notification drawer #725 and the other for the toast notifications #726. Considering this update out of scope for this particular PR however will address that update next. |
@@ -46,7 +46,7 @@ | |||
color: @navbar-pf-vertical-active-color; | |||
} | |||
} |
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.
Quick nit, you prob could eliminate this file from the PR as its just a whitespace change, or make sure you are using the patternfly/~.editorconfig
. If everyone contributing is using it little whitespace shuffles like this should disappear.
Pulled these updates into my local running I believe you are switching to a mobile layout too soon: So it seems 1,2 or 3 columns of content should work (the beauty of using flex), with varying lengths of text. I'd definitely like to see the date/time block collapse a bit as size decreases. There is a lot of opportunity to reclaim lost whitespace. |
@benjaminapetersen curious to see how this is built. Can you show me the markup for one of the notifications? |
@matthewcarleton We're using angular-patternfly, which is handling the markup. @jeff-phillips-18 Are any changes are needed downstream in angular-patternfly for this PR? |
@spadgett I think it is the notification body include that Matt is interested in. Angular Patternfly does not set the html layout of the notification body. |
Ah right, understood. Here is the markup structure: |
@spadgett ah ok. So from what I can see you've changed the structure quite a bit and that's going to effect how the areas react at the breakpoint. I can create a quick html prototype to show what you'd need to get it to work if that is helpful. |
I am somewhat interested in the reason to move away from a |
@benjaminapetersen I wasn't here when that decision was made but I would assume it's taken from bootstrap itself. If you look at their components they don't use page layout within theirs either. It could be to avoid verbose code. @andresgalante would have some more insight on this I'm sure. |
@matthewcarleton What is the normal structure? We can try to align if that's the right thing to do and it accommodates the design. This might break other downstream projects, though, since angular-patternfly allows any markup for the notification body. It seems like the CSS is assuming a lot about what the content is. Chaning flex-direction from row to column is significant :) We've had similar problems in the past upgrading Patternfly with components like list-view. |
addresses comments seen in #713 |
@spadgett @benjaminapetersen have a look at the following: http://recordit.co/Lf1wsgXM4Y I believe this is what you are trying to accomplish. I've followed the example code here http://www.patternfly.org/pattern-library/communication/notification-drawer/#/code I've added an additional This will allow you to make a simple change but stick to what patternfly suggests. |
Thanks @matthewcarleton for providing that. Related to this issue and from a PF perspective, I think that an expanded view of the notification drawer (with additional content) is a new requirement for PatternFly and requires design review and docs. Looping in @serenamarie125 as FYI who will help determine the priority for this. I've filed an issue against the patternfly-design repo regarding this issue to kick start a conversation: patternfly/patternfly-design#405 Since the above it out of scope, I'm going to merge this one and we will continue to follow up on the wizard as needed. |
Cross referencing some further updates @sg00dwin has done in the openshift web console to help improve readability with the type of content we are handling. PR includes some discussion to upstream a few items. |
Description
The purpose of this is to add support for the notification drawer on vertical nav for mobile.
We will still need to address the issue with the jQuery where to drawer does not close when the hamburger menu is selected. This was fixed with Jeff's PR below.
This is related to this story:
https://patternfly.atlassian.net/browse/PTNFLY-1461
Link to rawgit and/or image
Vertical Example
https://rawgit.com/matthewcarleton/patternfly/notification-drawer-mobile-dist/dist/tests/notification-drawer-vertical-nav.html
Horizontal Example
https://rawgit.com/matthewcarleton/patternfly/notification-drawer-mobile-dist/dist/tests/notification-drawer-horizontal-nav.html
PR checklist (if relevant)