Compare commits

...

3 Commits

Author SHA1 Message Date
e75fe75a5f Midi23d, resize youtube frame to max 100% 2019-06-17 14:37:24 +02:00
659803dcf0 Better navbar behavior
Home is now highlighted
2019-06-17 14:37:10 +02:00
f150f9561d Added Home, scroll to top on page change 2019-06-17 14:36:47 +02:00
4 changed files with 16 additions and 5 deletions

View File

@ -44,6 +44,10 @@ const routes: Routes = [
];
export const navigationLinks: NavigationLink[] = [
{
text: "Home",
address: "/"
},
{
text: "WarpPI",
address: "/page/WarpPI"
@ -83,7 +87,7 @@ export function fwlinkMatcher(url: UrlSegment[]): UrlMatchResult {
}
@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [RouterModule.forRoot(routes, {scrollPositionRestoration: "enabled"})],
exports: [RouterModule]
})
export class AppRoutingModule { }

View File

@ -7,14 +7,14 @@
[href]="link.address"
[target]="link.newtab === undefined || link.newtab === true ? '_blank' : '_self'"
rel="noopener"
[class.forcefocus] = "(currentDocument.onDocumentChange() | async)?.id == link.address"
[class.forcefocus] = "currentDocument?.id == link.address"
><span>{{link.text}}</span></a>
<a
*ngIf="link.external !== true"
[routerLink]="link.address"
[target]="link.newtab === true ? '_blank' : '_self'"
rel="noopener"
[class.force-focus] = "'/page/' + (currentDocument.onDocumentChange() | async)?.id == link.address"
[class.force-focus] = "'/page/' + currentDocument?.id == link.address || (currentDocument?.id == 'index' && link.address == '/')"
><span>{{link.text}}</span></a>
</li>
</ul>

View File

@ -4,6 +4,8 @@ import { ActivatedRoute, UrlSegment } from "@angular/router";
import { map } from "rxjs/operators";
import { CurrentDocumentService } from "src/app/services/current-document.service";
import { navigationLinks } from "src/app/app-routing.module";
import { DocumentData } from "src/app/symbols/DocumentData";
import { Observable } from "rxjs";
@Component({
selector: "app-navbar",
@ -18,8 +20,13 @@ export class NavbarComponent implements OnInit, AfterViewInit {
overflowMax = false;
@ViewChild("navlogo") navLogo: ElementRef<HTMLElement>;
@ViewChild("navbuttons") navButtons: ElementRef<HTMLElement>;
currentDocument: DocumentData;
constructor(private elRef: ElementRef<HTMLElement>, public currentDocument: CurrentDocumentService) { }
constructor(private elRef: ElementRef<HTMLElement>, currentDocument: CurrentDocumentService) {
currentDocument.onDocumentChange().subscribe(docData => {
this.currentDocument = docData;
});
}
ngOnInit() {
}

View File

@ -51,5 +51,5 @@ Enjoy
## Videos
<div style="margin: auto; text-align: center;">
<iframe width="560" height="315" src="https://www.youtube.com/embed/4rcnu8j1Xqk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/4rcnu8j1Xqk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen style="max-width: 100%;"></iframe>
</div>