From 706a95502387a46e08aa9c8c067e004120db2c05 Mon Sep 17 00:00:00 2001 From: Max Ehrlicher-Schmidt Date: Thu, 3 Sep 2020 15:29:20 +0200 Subject: [PATCH] Add Navbar Component --- .../components/navbar/navbar.component.html | 11 ++++++++ .../components/navbar/navbar.component.scss | 5 ++++ .../navbar/navbar.component.spec.ts | 25 +++++++++++++++++++ src/app/components/navbar/navbar.component.ts | 21 ++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 src/app/components/navbar/navbar.component.html create mode 100644 src/app/components/navbar/navbar.component.scss create mode 100644 src/app/components/navbar/navbar.component.spec.ts create mode 100644 src/app/components/navbar/navbar.component.ts diff --git a/src/app/components/navbar/navbar.component.html b/src/app/components/navbar/navbar.component.html new file mode 100644 index 0000000..de67fa6 --- /dev/null +++ b/src/app/components/navbar/navbar.component.html @@ -0,0 +1,11 @@ + + Flotte + + +
+ Dark Mode +
+
+
diff --git a/src/app/components/navbar/navbar.component.scss b/src/app/components/navbar/navbar.component.scss new file mode 100644 index 0000000..0c8fa30 --- /dev/null +++ b/src/app/components/navbar/navbar.component.scss @@ -0,0 +1,5 @@ +#navbar { + #menu-trigger-button { + margin-left: auto + } +} diff --git a/src/app/components/navbar/navbar.component.spec.ts b/src/app/components/navbar/navbar.component.spec.ts new file mode 100644 index 0000000..9032ad2 --- /dev/null +++ b/src/app/components/navbar/navbar.component.spec.ts @@ -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; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NavbarComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NavbarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/navbar/navbar.component.ts b/src/app/components/navbar/navbar.component.ts new file mode 100644 index 0000000..1c568d1 --- /dev/null +++ b/src/app/components/navbar/navbar.component.ts @@ -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"); + } +}