Updated site to use momentum for contacting, registration, gallery and calendar, as well as some other updates to the site content
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import {AfterViewInit, Component, EventEmitter, Input, OnDestroy, Output} from '@angular/core';
|
||||
import {ActivatedRoute, NavigationEnd, NavigationStart, Router} from '@angular/router';
|
||||
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
|
||||
import {combineLatest, filter, Subscription} from 'rxjs';
|
||||
import {NAVIGATION} from '../../misc/navigation';
|
||||
import {BreakpointService} from '../../services/breakpoint.service';
|
||||
import {NAVIGATION, NavigationItem} from '../../misc/navigation';
|
||||
import {MomentumService} from '../../services/momentum.service';
|
||||
|
||||
@Component({
|
||||
selector: 'xxx-navbar',
|
||||
@@ -21,7 +21,7 @@ export class NavbarComponent implements AfterViewInit, OnDestroy {
|
||||
|
||||
@Output() hamburgerClick = new EventEmitter<void>();
|
||||
|
||||
constructor(private route: ActivatedRoute, private router: Router, public breakpoint: BreakpointService) { }
|
||||
constructor(private route: ActivatedRoute, private router: Router, public momentum: MomentumService) { }
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.sub = combineLatest([this.router.events.pipe(filter((e: any) => e.navigationTrigger != 'popstate' || e instanceof NavigationStart)), this.route.fragment]).subscribe(([url, frag]) => {
|
||||
@@ -34,6 +34,15 @@ export class NavbarComponent implements AfterViewInit, OnDestroy {
|
||||
if(this.sub) this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
openItem(item: NavigationItem) {
|
||||
// Full url
|
||||
if(item.url.startsWith('http'))
|
||||
location.href = item.url;
|
||||
// Relative
|
||||
else
|
||||
this.router.navigate([item.url], {fragment: item.fragment});
|
||||
}
|
||||
|
||||
scroll(id: string) {
|
||||
const el = document.getElementById(id);
|
||||
if(el) el.scrollIntoView({behavior: 'smooth'});
|
||||
|
||||
Reference in New Issue
Block a user