Add Navbar Component

pull/1/head
Max Ehrlicher-Schmidt 4 years ago
parent 4f23c12c6e
commit 706a955023

@ -0,0 +1,11 @@
<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>

@ -0,0 +1,5 @@
#navbar {
#menu-trigger-button {
margin-left: auto
}
}

@ -0,0 +1,25 @@
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();
});
});

@ -0,0 +1,21 @@
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…
Cancel
Save