-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Drawer] Support all types of navigation drawers in the Material Design Guidelines #6878
Conversation
…next v1.0.0-alpha.13
…e layout (overflow is on body instead of AppContent)
… box and dimensions instead of the viewport
* If `false`, let the child element slide in from outside the viewport. | ||
* Set to `true` to let the child element slide in from outside its own | ||
* bounding box and position. | ||
*/ |
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 are using the pattern: "If true
the child element slides in from outside its own bounding box and position"
Not sure how best to address the default case - perhaps follow the above with: "; by default, the child element slide in from outside the viewport."?
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.
That makes sense! Good call on scrapping the "let"s too.
@Zuurkern Thanks for your hard work on this - it looks great! Please could you rebase - there have been some conflicting changes since. @oliviertassinari any thoughts on the name for the |
@mbrookes thanks for picking this back up and sorry for not following up on this sooner, I'm working on another, older project right now (and miss material-ui sooo bad) and I'm short on time. I did some battle testing last week, trying to get creative with the Drawer to see how well it holds up flexibility wise. I made some small adjustments and took notes for things I would like to improve and/or discuss. I will try to make time this weekend to write those out and post here. In its current state though, getting a basic layout down as described in the guidelines (drawer, app bar, content synergy) is really easy. You can basically just copy paste the demos. I tested the demos in latest Chrome, Firefox, Safari, Edge and IE11 (I think) as well. It just works. I'll rebase too when I dive back into the code. |
Fantastic, thanks for sticking with it - it'll be here when you get time. 👍 |
Thanks for implementing this one! I'd be happy to fork & rebase — is that something I could help with to get this shipped? |
Hey guys, sorry about the radio silence. I was going to post my findings like a month ago but some things have changed in the meantime. There have been some changes to the API in general and other components that Drawer is composed of:
paperClassName prop is gone now and I've tried to get rid of it as well because the mini variant implementation makes the stylesheet too specific (you have to use !important to do non-MD-spec stuff when trying to override CSS via this prop) - this was one of my gripes with my current implementation. I still think we should add support for width to Collapse first (for the mini variant) and then revisit Drawer to make it leaner in the render function and be a good example of how to compose more complex components from other components (Paper, Slide, Collapse). |
What about clipped drawers? |
Clipped drawers are just a matter of leaving the AppBar styling as is. It's not really something Drawer controls, except for maybe adding a top padding the same height as the AppBar. I considered adding seperate demos for clipped drawers but decided not to because I just wanted some proof of concept for the changes I made to the Drawer component. |
@Zuurkern what is the status on the PR? |
@mbrookes @Zuurkern @oliviertassinari When is this expected to be released? Our team is needing a mini-variant navigation bar and this looks extremely promising. |
It would be great to have a navigation drawer clipped under the AppBar so it doesn't cover the site brand and burger icon when open on mobile. |
Should it matter? Clipping and permanence are independent. |
@wtgtybhertgeghgtwtg is there a standard defined for that behavior? |
@cr101 I'm familiar with this document, but unfortunately it doesn't support your request:
The only thing that comes close is a permanent navigation drawer:
Or perhaps the mini-variant of the persistent navigation drawer:
However, it is not suitable for mobile:
The standard requires a temporary navigation drawer for mobile:
|
@kgregory I'm after a permanent, clipped drawer like the example below:
|
@cr101 right.. |
I'm going to resume this work as the oldest PR we have open, will move to the other after. |
Description
The Material Design Guidelines specify different navigation drawer types/behaviors under Patterns. This PR aims to support all of those types, true to the spec, while retaining or hopefully expanding the flexibility of the Drawer component. It also adds demos to show how you can create all of these behaviors in your app, as some of these patterns require the Drawer, AppBar and a content element to work together in harmony.
Should close #4773 and possibly #4752 and #6451? (the latter two are for master though I think)
I apologize in advance for potentially bad JS code, I have only been coding in React (or JS for that matter) for a couple of months. But we have to start somewhere, right?
I also haven't written tests as I haven't figured out the testing tools yet :/ Sorry about that.
About changes to [Slide]
For the persistent navigation drawer demo to work, I had to modify Slide and give it a prop to transition its child element from outside its own position in the DOM instead of from outside the viewport. Without this, the transitions on the AppBar and content wouldn't sync up nicely with the Drawer's. In a real scenario where your app fills the entire viewport, you won't need this. Still, I think this opens up possibilities to get creative with the Drawer component (which passes this optional prop on to Slide). Also, I think it's a nice addition to Slide. I'm having a hard time coming up with a succinct and descriptive prop name for it though. Would love to discuss all of this further.
Hardcoding of the width transition for the mini variant
Currently, the width transition for the mini variant is hardcoded into the stylesheet. I was thinking maybe we could add support for width to the Collapse component and use that so it's more configurable. What do you think about this?