Skip to content

Commit

Permalink
feat(examples): enhance responsivenes of submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
tomastrajan committed Mar 6, 2018
1 parent f991231 commit a22cd8e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/examples/authenticated/authenticated.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ <h1 class="main-heading">Authenticated component</h1>
<p>
This component is only accessible for authenticated users
</p>
<p>
Logging out will cause user to be redirected to home screen if visiting route
accessible only to authenticated users
</p>
</div>
</div>
</div>
25 changes: 24 additions & 1 deletion src/app/examples/examples/examples.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<nav mat-tab-nav-bar>
<nav mat-tab-nav-bar class="d-none d-md-block">
<a mat-tab-link
*ngFor="let e of examples"
[routerLink]="e.link"
Expand All @@ -7,6 +7,29 @@
{{e.label}}
</a>
</nav>

<div class="nav-responsive d-md-none">
<span *ngFor="let e of examples"
[routerLink]="e.link"
routerLinkActive #rla="routerLinkActive">
<button *ngIf="rla.isActive" mat-raised-button
color="primary"
[matMenuTriggerFor]="examplesMenu">
<span><mat-icon>menu</mat-icon> {{e.label}}</span>
</button>
</span>
<mat-menu #examplesMenu="matMenu">
<button mat-menu-item
*ngFor="let e of examples"
[routerLink]="e.link"
routerLinkActive #rla="routerLinkActive"
ngClass="{ active: rla.isActive }">
{{e.label}}
</button>
</mat-menu>
</div>


<div [@routerTransition]="o.isActivated && o.activatedRoute.routeConfig.path">
<router-outlet #o="outlet"></router-outlet>
</div>
14 changes: 14 additions & 0 deletions src/app/examples/examples/examples.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
nav {
margin-bottom: 20px;
}

.nav-responsive {
margin: 14px;

button {
width: 100%;

mat-icon {
float: left;
position: relative;
top: 7px;
}
}
}

0 comments on commit a22cd8e

Please sign in to comment.