Skip to content

Commit aa6c740

Browse files
committed
feat(sidenav): add fullscreen mode
1 parent 2f3e9db commit aa6c740

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

src/components/sidenav/sidenav.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ $md-sidenav-push-background-color: md-color($md-background, dialog) !default;
4242
}
4343
}
4444

45+
/* This mixin ensures a sidenav element spans the whole viewport. */
46+
@mixin md-sidenav-fullscreen {
47+
position: absolute;
48+
top: 0;
49+
left: 0;
50+
right: 0;
51+
bottom: 0;
52+
}
53+
4554

4655
:host {
4756
// We need a stacking context here so that the backdrop and drawers are clipped to the
@@ -52,18 +61,18 @@ $md-sidenav-push-background-color: md-color($md-background, dialog) !default;
5261

5362
box-sizing: border-box;
5463

64+
&[fullscreen] {
65+
@include md-sidenav-fullscreen();
66+
}
67+
5568
// Need this to take up space in the layout.
5669
display: block;
5770

5871
// Hide the sidenavs when they're closed.
5972
overflow-x: hidden;
6073

6174
& > .md-sidenav-backdrop {
62-
position: absolute;
63-
top: 0;
64-
left: 0;
65-
right: 0;
66-
bottom: 0;
75+
@include md-sidenav-fullscreen();
6776

6877
display: block;
6978

src/demo-app/demo-app.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<md-sidenav-layout class="demo-root">
1+
<md-sidenav-layout class="demo-root" fullscreen>
22
<md-sidenav #start>
33
<md-nav-list>
44
<a md-list-item [routerLink]="['ButtonDemo']">Button</a>

src/demo-app/demo-app.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
.demo-root {
22
font-family: Roboto, 'Helvetica Neue', sans-serif;
3-
position: absolute;
4-
top: 0;
5-
bottom: 0;
6-
left: 0;
7-
right: 0;
83

94
// Helps fonts on OSX looks more consistent with other systems
105
// Isn't currently in button styles due to performance concerns

0 commit comments

Comments
 (0)