Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit d8c4a66

Browse files
mmalerbaamcdnl
authored andcommitted
use fixed sidenav for mobile (#298)
1 parent b889f42 commit d8c4a66

File tree

6 files changed

+48
-28
lines changed

6 files changed

+48
-28
lines changed

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
},
1919
"private": true,
2020
"dependencies": {
21-
"@angular/animations": "^4.4.3",
21+
"@angular/animations": "^4.4.4",
2222
"@angular/cdk": "2.0.0-beta.12",
23-
"@angular/common": "^4.4.3",
24-
"@angular/compiler": "^4.4.3",
25-
"@angular/core": "^4.4.3",
26-
"@angular/forms": "^4.4.3",
27-
"@angular/http": "^4.4.3",
23+
"@angular/common": "^4.4.4",
24+
"@angular/compiler": "^4.4.4",
25+
"@angular/core": "^4.4.4",
26+
"@angular/forms": "^4.4.4",
27+
"@angular/http": "^4.4.4",
2828
"@angular/material": "2.0.0-beta.12",
29-
"@angular/platform-browser": "^4.4.3",
30-
"@angular/platform-browser-dynamic": "^4.4.3",
31-
"@angular/router": "^4.4.3",
29+
"@angular/platform-browser": "^4.4.4",
30+
"@angular/platform-browser-dynamic": "^4.4.4",
31+
"@angular/router": "^4.4.4",
3232
"@angular/service-worker": "^1.0.0-beta.16",
3333
"core-js": "^2.4.1",
3434
"rxjs": "^5.1.0",
3535
"zone.js": "^0.8.4"
3636
},
3737
"devDependencies": {
3838
"@angular/cli": "^1.0.0",
39-
"@angular/compiler-cli": "^4.4.3",
39+
"@angular/compiler-cli": "^4.4.4",
4040
"@types/jasmine": "^2.5.41",
4141
"@types/node": "^7.0.5",
4242
"hammerjs": "^2.0.8",

src/app/material-docs-app.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
<app-navbar class="mat-elevation-z6"></app-navbar>
22
<router-outlet></router-outlet>
3+

src/app/material-docs-app.scss

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
material-docs-app {
2+
display: flex;
3+
flex-direction: column;
24
position: absolute;
3-
top: 0;
5+
top: 56px;
46
bottom: 0;
57
left: 0;
68
right: 0;
7-
display: flex;
8-
flex-direction: column;
9+
}
10+
11+
app-navbar {
12+
position: fixed;
13+
top: 0;
14+
left: 0;
15+
right: 0;
16+
z-index: 2;
917
}
1018

1119
material-docs-app > app-component-sidenav {
12-
flex: 1 1 auto;
20+
flex: 1;
1321
}
1422

15-
// Target last-child as it will be the output of the router-outlet within the app's container.
16-
material-docs-app > :last-child {
23+
material-docs-app > app-homepage,
24+
material-docs-app > app-guides,
25+
material-docs-app > guide-viewer {
1726
overflow-y: auto;
1827
}
1928

20-
app-navbar {
21-
position: relative;
22-
z-index: 10;
29+
@media (max-width: 720px) {
30+
material-docs-app {
31+
top: 92px;
32+
}
33+
34+
material-docs-app > app-homepage,
35+
material-docs-app > app-guides,
36+
material-docs-app > guide-viewer {
37+
overflow-y: visible;
38+
}
2339
}

src/app/pages/component-sidenav/component-sidenav.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<mat-sidenav-container class="docs-component-viewer-sidenav-container">
22
<mat-sidenav #sidenav class="docs-component-viewer-sidenav"
33
[opened]="!isScreenSmall()"
4-
[mode]="isScreenSmall() ? 'over' : 'side'">
4+
[mode]="isScreenSmall() ? 'over' : 'side'"
5+
[fixedInViewport]="isScreenSmall()"
6+
fixedTopGap="92">
57
<nav *ngFor="let category of docItems.getCategories((params | async)?.section)">
68
<h3>{{category.name}}</h3>
79
<ul>

src/app/pages/component-sidenav/component-sidenav.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ $sidenav-width: 240px;
33

44
app-component-sidenav {
55
display: flex;
6+
flex-direction: column;
67
}
78

89
.docs-component-viewer-sidenav-container {
9-
width: 100%;
10-
11-
.mat-drawer-content {
12-
position: absolute;
13-
right: 0;
14-
left: 0;
15-
}
10+
flex: 1;
1611
}
1712

1813
.docs-component-viewer-sidenav {
@@ -86,3 +81,9 @@ app-component-sidenav {
8681
flex-grow: 1;
8782
}
8883
}
84+
85+
@media (max-width: 720px) {
86+
.docs-component-viewer-sidenav-container {
87+
flex: 1 0 auto;
88+
}
89+
}

src/app/pages/component-sidenav/component-sidenav.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {ComponentHeaderModule} from '../component-page-header/component-page-hea
88
import {FooterModule} from '../../shared/footer/footer';
99
import {Observable} from 'rxjs/Observable';
1010

11-
const SMALL_WIDTH_BREAKPOINT = 840;
11+
const SMALL_WIDTH_BREAKPOINT = 720;
1212

1313
@Component({
1414
selector: 'app-component-sidenav',

0 commit comments

Comments
 (0)