Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 59ad3d2

Browse files
committed
Sidenav design
1 parent 26dfd56 commit 59ad3d2

File tree

4 files changed

+94
-43
lines changed

4 files changed

+94
-43
lines changed

src/app/app.component.html

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
1-
<md-sidenav-container fullscreen>
1+
<div class="app-fullpage">
22
<md-toolbar color="accent" class="mat-elevation-z6">
33
<button md-icon-button (click)="sidenav.toggle()">
4-
<md-icon>
5-
menu
6-
</md-icon>
7-
</button>
4+
<md-icon>
5+
menu
6+
</md-icon>
7+
</button>
88
<span class="title"> RxJS Docs </span>
99
</md-toolbar>
10-
<md-sidenav #sidenav>
11-
<md-toolbar>
12-
<span>
13-
<button md-button routerLink="/">
14-
Home
15-
</button>
16-
</span>
17-
<md-toolbar-row>
18-
<button md-button routerLink="/operators">
19-
Operators
20-
</button>
21-
</md-toolbar-row>
22-
<md-toolbar-row>
23-
<button md-button routerLink="/companies">
24-
Companies
25-
</button>
26-
</md-toolbar-row>
27-
<md-toolbar-row>
28-
<button md-button routerLink="/team">
29-
Team
30-
</button>
31-
</md-toolbar-row>
32-
</md-toolbar>
33-
</md-sidenav>
34-
<div class="body-margin">
35-
<router-outlet></router-outlet>
36-
</div>
37-
</md-sidenav-container>
10+
<md-sidenav-container>
11+
<md-sidenav #sidenav>
12+
<md-nav-list (click)="sidenav.toggle()">
13+
<a *ngFor="let menu of menus" md-list-item routerLinkActive="active"
14+
[routerLinkActiveOptions]="menu.options"
15+
[routerLink]="menu.link">
16+
{{menu.title}}
17+
</a>
18+
</md-nav-list>
19+
</md-sidenav>
20+
<div class="body-margin">
21+
<router-outlet></router-outlet>
22+
</div>
23+
</md-sidenav-container>
24+
</div>

src/app/app.component.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
import { Component } from '@angular/core';
22

3+
class Menu {
4+
title: string;
5+
link: string;
6+
options: { exact: boolean };
7+
}
8+
39
@Component({
410
selector: 'app-root',
511
templateUrl: './app.component.html',
612
styleUrls: ['./app.component.scss']
713
})
814
export class AppComponent {
9-
title = 'app';
15+
menus: Menu[] = [
16+
{
17+
title: 'Home',
18+
link: '/',
19+
options: { exact: true }
20+
},
21+
{
22+
title: 'Operators',
23+
link: '/operators',
24+
options: { exact: false }
25+
},
26+
{
27+
title: 'Companies',
28+
link: '/companies',
29+
options: { exact: false }
30+
},
31+
{
32+
title: 'Team',
33+
link: '/team',
34+
options: { exact: false }
35+
}
36+
]
1037
}

src/app/app.module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
33
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
4-
import { MdToolbarModule, MdSidenavModule, MdIconModule, MdButtonModule } from '@angular/material';
4+
import { MdToolbarModule, MdSidenavModule, MdIconModule, MdButtonModule, MdListModule } from '@angular/material';
55
import { RouterModule } from '@angular/router';
66

77
import { RXJS_DOC_ROUTES } from './app.routing';
@@ -27,7 +27,8 @@ import { RxjsComponent } from './rxjs/rxjs.component';
2727
MdToolbarModule,
2828
MdSidenavModule,
2929
MdIconModule,
30-
MdButtonModule
30+
MdButtonModule,
31+
MdListModule
3132
],
3233
providers: [],
3334
bootstrap: [AppComponent]

src/styles.scss

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
1-
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
1+
@import "~@angular/material/theming";
2+
@include mat-core();
3+
4+
// Define the theme.
5+
$primary: mat-palette($mat-indigo);
6+
$accent: mat-palette($mat-pink);
7+
$theme: mat-light-theme($primary, $accent);
8+
@include angular-material-theme($theme);
29

310
body {
4-
font-family: Roboto;
5-
margin: 0px;
6-
}
11+
font-family: Roboto, sans-serif;
12+
}
13+
14+
html, body {
15+
margin: 0;
16+
width: 100%;
17+
height: 100%;
18+
}
19+
20+
.app-fullpage {
21+
position: absolute;
22+
top: 0;
23+
bottom: 0;
24+
left: 0;
25+
right: 0;
26+
display: flex;
27+
flex-direction: column;
28+
}
29+
30+
md-sidenav-container {
31+
flex: 1 1 auto;
32+
width: 100%;
33+
height: 100%;
34+
}
35+
36+
md-sidenav {
37+
width: 200px;
38+
}
39+
40+
md-sidenav a.active .mat-list-item-content {
41+
color: mat-color($accent);
42+
}
743

8-
.body-margin {
9-
margin: 50px;
10-
}
44+
.body-margin {
45+
margin: 50px;
46+
}

0 commit comments

Comments
 (0)