Formatting, adding comments

This commit is contained in:
Patrick Müller 2022-09-08 17:41:10 +02:00
parent 0889c101aa
commit b300fe1b7b
Signed by: Paddy
GPG Key ID: 37ABC11275CAABCE
3 changed files with 13 additions and 10 deletions

View File

@ -7,7 +7,7 @@
<div (click)="navigate('/stats')">Stats</div>
</div>
<div id="menu-mobile">
<div id="menu-mobile-dropdown-button" (click)="openMobileDropdown()">Open</div>
<div id="menu-mobile-dropdown-button" (click)="toggleMobileDropdown()">Open</div>
<div id="menu-mobile-dropdown-content">
<div (click)="navigate('/')">Home</div>
<div (click)="navigate('/gamenight')">Game night</div>

View File

@ -43,6 +43,7 @@
display: inherit;
}
}
@media(max-width: 767px) {
#menu-desktop {
display: none;

View File

@ -1,7 +1,7 @@
import {Component, OnInit} from '@angular/core';
import {User} from '../../models/user';
import {StorageService} from '../../services/storage.service';
import {Router} from "@angular/router";
import {Router} from '@angular/router';
@Component({
selector: 'app-header',
@ -28,6 +28,7 @@ export class HeaderComponent implements OnInit {
this.showProfilePopOver = false;
}
getUserName(): string {
return this.user ? this.user.firstName : 'Logged out';
}
@ -36,12 +37,13 @@ export class HeaderComponent implements OnInit {
this.router.navigate([path]);
}
openMobileDropdown() : void {
const dropdownContentStyle = document.getElementById("menu-mobile-dropdown-content")!.style;
if(dropdownContentStyle.display == "block")
dropdownContentStyle.display = "none";
else {
dropdownContentStyle.display = "block";
toggleMobileDropdown(): void {
const dropdownContentStyle = document.getElementById('menu-mobile-dropdown-content')!.style;
if (dropdownContentStyle.display == 'block') {
//FIXME: Currently doesn't work because content overlaps button
dropdownContentStyle.display = 'none';
} else {
dropdownContentStyle.display = 'block';
}
}
}