Add sidenav
parent
c8de25cbd5
commit
4438d166e4
@ -1,2 +1,42 @@
|
||||
<app-navbar></app-navbar>
|
||||
<div id="page-wrapper">
|
||||
<mat-toolbar id="navbar">
|
||||
<button mat-icon-button (click)="sidenav.toggle()">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
<span>Flotte</span>
|
||||
<button mat-icon-button [matMenuTriggerFor]="menu" id="menu-trigger-button">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<div
|
||||
mat-menu-item
|
||||
disableRipple="true"
|
||||
(click)="$event.stopPropagation()"
|
||||
>
|
||||
<mat-slide-toggle
|
||||
(change)="changeTheme($event)"
|
||||
[checked]="darkThemeIsActive"
|
||||
>Dark Mode</mat-slide-toggle
|
||||
>
|
||||
</div>
|
||||
</mat-menu>
|
||||
</mat-toolbar>
|
||||
|
||||
<mat-sidenav-container id="content">
|
||||
<mat-sidenav #sidenav>
|
||||
<mat-nav-list>
|
||||
<a mat-list-item [routerLink]="'/accounts'"> Accounts </a>
|
||||
<a mat-list-item [routerLink]="'/create-account'"> Create Account </a>
|
||||
<a mat-list-item [routerLink]="'/contacts'"> Contacts </a>
|
||||
<a mat-list-item [routerLink]="'/create-contact'"> Create Contact </a>
|
||||
<a mat-list-item [routerLink]="'/activities'"> Activities </a>
|
||||
<a mat-list-item [routerLink]="'/create-activity'"> Create Activity </a>
|
||||
</mat-nav-list>
|
||||
</mat-sidenav>
|
||||
<mat-sidenav-content>
|
||||
<div>
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</mat-sidenav-content>
|
||||
</mat-sidenav-container>
|
||||
</div>
|
||||
|
@ -0,0 +1,14 @@
|
||||
#page-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
#content {
|
||||
flex: 1;
|
||||
}
|
||||
#navbar {
|
||||
flex: none;
|
||||
#menu-trigger-button {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<mat-toolbar id="navbar">
|
||||
<span>Flotte</span>
|
||||
<button mat-icon-button [matMenuTriggerFor]="menu" id="menu-trigger-button">
|
||||
<mat-icon>more_vert</mat-icon>
|
||||
</button>
|
||||
<mat-menu #menu="matMenu">
|
||||
<div mat-menu-item disableRipple="true" (click) = "$event.stopPropagation()">
|
||||
<mat-slide-toggle (change)="changeTheme($event)" [checked]="darkThemeIsActive">Dark Mode</mat-slide-toggle>
|
||||
</div>
|
||||
</mat-menu>
|
||||
</mat-toolbar>
|
@ -1,5 +0,0 @@
|
||||
#navbar {
|
||||
#menu-trigger-button {
|
||||
margin-left: auto
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NavbarComponent } from './navbar.component';
|
||||
|
||||
describe('NavbarComponent', () => {
|
||||
let component: NavbarComponent;
|
||||
let fixture: ComponentFixture<NavbarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavbarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -1,21 +0,0 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ColorThemeService } from '../../services/colorTheme.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar',
|
||||
templateUrl: './navbar.component.html',
|
||||
styleUrls: ['./navbar.component.scss'],
|
||||
})
|
||||
export class NavbarComponent implements OnInit {
|
||||
darkThemeIsActive: boolean = false;
|
||||
constructor(private themeService: ColorThemeService) {
|
||||
this.darkThemeIsActive = this.themeService.currentActive() === "dark-theme";
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
changeTheme(event) {
|
||||
this.themeService.update((event.checked) ? "dark-theme" : "light-theme");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue