banner & styling

This commit is contained in:
2022-09-19 11:34:42 -04:00
parent bd9ef9214e
commit a8e4b4371b
31 changed files with 265 additions and 58 deletions

View File

@@ -1,12 +1,34 @@
import {Component, EventEmitter, Input, Output} from '@angular/core';
import {AfterViewInit, Component, EventEmitter, Input, OnDestroy, Output} from '@angular/core';
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router';
import {filter, Subscription} from 'rxjs';
@Component({
selector: 'xxx-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent {
export class NavbarComponent implements AfterViewInit, OnDestroy {
private sub!: Subscription;
@Input() hamburger = true;
@Output() hamburgerClick = new EventEmitter<void>();
constructor(private route: ActivatedRoute) { }
ngAfterViewInit() {
this.sub = this.route.fragment.subscribe(frag => {
if(frag) this.scroll(frag);
});
}
ngOnDestroy(): void {
if(this.sub) this.sub.unsubscribe();
}
scroll(id: string) {
const el = document.getElementById(id);
if(el) el.scrollIntoView({behavior: 'smooth'});
else setTimeout(() => this.scroll(id), 500);
}
}