-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
feat(sidenav): Add support for fixed sidenavs #6712
Conversation
src/lib/sidenav/drawer.ts
Outdated
@@ -22,7 +22,7 @@ import { | |||
NgZone, | |||
OnDestroy, | |||
Inject, | |||
ChangeDetectorRef, | |||
ChangeDetectorRef, ContentChild, forwardRef, |
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.
Reformat?
src/lib/sidenav/drawer.ts
Outdated
}) | ||
export class MdDrawerContent implements AfterContentInit { | ||
/** Margins to be applied to the content. */ | ||
_margins: {left: number, right: number} = {left: 0, right: 0}; |
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.
Why are these margins here? Add explanation for why this is a thing?
src/lib/sidenav/drawer.ts
Outdated
} | ||
|
||
ngAfterContentInit() { | ||
this._container._contentMargins.subscribe((margins) => { |
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.
nit: don't need parents around margins
src/lib/sidenav/drawer.ts
Outdated
@@ -155,6 +193,8 @@ export class MdDrawer implements AfterContentInit, OnDestroy { | |||
/** @deprecated */ | |||
@Output('align-changed') onAlignChanged = new EventEmitter<void>(); | |||
|
|||
_modeChanged = new Subject(); |
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.
Add comment explaining why this is a thing?
src/lib/sidenav/drawer.ts
Outdated
private _updateContentMargins() { | ||
let left = 0; | ||
let right = 0; | ||
|
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.
Add comment that describes which style is applied where based on the mode + position?
src/lib/sidenav/sidenav.ts
Outdated
export class MdSidenav extends MdDrawer {} | ||
export class MdSidenav extends MdDrawer { | ||
/** Whether the sidenav is fixed in the viewport. */ | ||
@Input() fixedInViewport = true; |
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.
Use coerceBooleanProperty
src/lib/sidenav/sidenav.ts
Outdated
* The gap between the top of the sidenav and the top of the viewport when the sidenav is in fixed | ||
* mode. | ||
*/ | ||
@Input() fixedTopGap = 0; |
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.
Use coerceNumberProperty
src/lib/sidenav/sidenav.ts
Outdated
export class MdSidenav extends MdDrawer {} | ||
export class MdSidenav extends MdDrawer { | ||
/** Whether the sidenav is fixed in the viewport. */ | ||
@Input() fixedInViewport = true; |
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.
Add unit tests for these new fixed properties?
@jelbourn comments addressed |
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.
LGTM
859fc7b
to
ff9307f
Compare
c491cfe
to
bf1cc46
Compare
21dbdec
to
8d77c32
Compare
Can we get this into the material2-builds? |
Do you have the source code for the working version in the demo? |
@KKHAN1991 I looked into the css of the working example
and then apply this to your footer item like so:
Then I just call my app-footer (i made a component for this) inside my sidebar nav and below my navbar like so;
Hope this helps, ive spent the past 4 hours fixing problems and getting it working so i hope i can save someone time |
@KKHAN1991 here is the demo: https://material2-dev.firebaseapp.com/sidenav, and here are the files that produce it: https://github.com/angular/material2/tree/master/src/demo-app/sidenav. It works well. |
Is there any documentation for this feature other than just |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
temporary demo: https://mmalerba-demo5.firebaseapp.com/sidenav
fixes #3031
fixes #1515
fixes #1179
fixes #998
fixes #778