Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 20 additions & 33 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
<md-sidenav-container fullscreen>
<div class="app-fullpage">
<md-toolbar color="accent" class="mat-elevation-z6">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make the toolbar sticky, thoughts? @ladyleet @feloy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look how to do this. Previous solution wasn't perfect because sidenav was on top of toolbar.
It seems that "md-sidenav-container fullscreen" is not usable with a toolbar

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capture du 2017-10-03 19 43 28

In fact the toolbar is already sticky, isn't it? At least on Chrome and Firefox on Linux

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, just tested again and it looks great! 👍

<button md-icon-button (click)="sidenav.toggle()">
<md-icon>
menu
</md-icon>
</button>
<md-icon>
menu
</md-icon>
</button>
<span class="title"> RxJS Docs </span>
</md-toolbar>
<md-sidenav #sidenav>
<md-toolbar>
<span>
<button md-button routerLink="/">
Home
</button>
</span>
<md-toolbar-row>
<button md-button routerLink="/operators">
Operators
</button>
</md-toolbar-row>
<md-toolbar-row>
<button md-button routerLink="/companies">
Companies
</button>
</md-toolbar-row>
<md-toolbar-row>
<button md-button routerLink="/team">
Team
</button>
</md-toolbar-row>
</md-toolbar>
</md-sidenav>
<div class="body-margin">
<router-outlet></router-outlet>
</div>
</md-sidenav-container>
<md-sidenav-container>
<md-sidenav #sidenav>
<md-nav-list (click)="sidenav.toggle()">
<a *ngFor="let menu of menus" md-list-item routerLinkActive="active"
[routerLinkActiveOptions]="menu.options"
[routerLink]="menu.link">
{{menu.title}}
</a>
</md-nav-list>
</md-sidenav>
<div class="body-margin">
<router-outlet></router-outlet>
</div>
</md-sidenav-container>
</div>
29 changes: 28 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
import { Component } from '@angular/core';

class Menu {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update this to an interface?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feloy thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do that

title: string;
link: string;
options: { exact: boolean };
}

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'app';
menus: Menu[] = [
{
title: 'Home',
link: '/',
options: { exact: true }
},
{
title: 'Operators',
link: '/operators',
options: { exact: false }
},
{
title: 'Companies',
link: '/companies',
options: { exact: false }
},
{
title: 'Team',
link: '/team',
options: { exact: false }
}
]
}
5 changes: 3 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MdToolbarModule, MdSidenavModule, MdIconModule, MdButtonModule } from '@angular/material';
import { MdToolbarModule, MdSidenavModule, MdIconModule, MdButtonModule, MdListModule } from '@angular/material';
import { RouterModule } from '@angular/router';

import { RXJS_DOC_ROUTES } from './app.routing';
Expand All @@ -27,7 +27,8 @@ import { RxjsComponent } from './rxjs/rxjs.component';
MdToolbarModule,
MdSidenavModule,
MdIconModule,
MdButtonModule
MdButtonModule,
MdListModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
50 changes: 43 additions & 7 deletions src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,46 @@
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
@import "~@angular/material/theming";
@include mat-core();

// Define the theme.
$primary: mat-palette($mat-indigo);
$accent: mat-palette($mat-pink);
$theme: mat-light-theme($primary, $accent);
@include angular-material-theme($theme);

body {
font-family: Roboto;
margin: 0px;
}
font-family: Roboto, sans-serif;
}

html, body {
margin: 0;
width: 100%;
height: 100%;
}

.app-fullpage {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
}

md-sidenav-container {
flex: 1 1 auto;
width: 100%;
height: 100%;
}

md-sidenav {
width: 200px;
}

md-sidenav a.active .mat-list-item-content {
color: mat-color($accent);
}

.body-margin {
margin: 50px;
}
.body-margin {
margin: 50px;
}