added path query
This commit is contained in:
parent
1af7d637c4
commit
aa035ac60d
3 changed files with 51 additions and 7 deletions
|
|
@ -2,20 +2,45 @@
|
||||||
<img class="logo" src="./assets/img/sidebar/logo.svg" alt="" />
|
<img class="logo" src="./assets/img/sidebar/logo.svg" alt="" />
|
||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<div id="navLinkSummary" class="nav-links-inner" routerLink="summary">
|
<div
|
||||||
|
id="navLinkSummary"
|
||||||
|
class="nav-links-inner"
|
||||||
|
routerLink="summary"
|
||||||
|
[ngClass]="{
|
||||||
|
active: currentPath == 'summary'
|
||||||
|
}"
|
||||||
|
>
|
||||||
<img src="./assets/img/sidebar/summary.svg" alt="sumary" /><span
|
<img src="./assets/img/sidebar/summary.svg" alt="sumary" /><span
|
||||||
>Summary</span
|
>Summary</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div id="navLinkAddTask" class="nav-links-inner">
|
<div
|
||||||
|
id="navLinkAddTask"
|
||||||
|
class="nav-links-inner"
|
||||||
|
[ngClass]="{
|
||||||
|
active: currentPath == 'addtask'
|
||||||
|
}"
|
||||||
|
>
|
||||||
<img src="./assets/img/sidebar/add-task.svg" alt="addtask" /><span
|
<img src="./assets/img/sidebar/add-task.svg" alt="addtask" /><span
|
||||||
>Add Task</span
|
>Add Task</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div id="navLinkBoard" class="nav-links-inner">
|
<div
|
||||||
|
id="navLinkBoard"
|
||||||
|
class="nav-links-inner"
|
||||||
|
[ngClass]="{
|
||||||
|
active: currentPath == 'board'
|
||||||
|
}"
|
||||||
|
>
|
||||||
<img src="./assets/img/sidebar/board.svg" alt="board" /><span>Board</span>
|
<img src="./assets/img/sidebar/board.svg" alt="board" /><span>Board</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="navLinkContacts" class="nav-links-inner">
|
<div
|
||||||
|
id="navLinkContacts"
|
||||||
|
class="nav-links-inner"
|
||||||
|
[ngClass]="{
|
||||||
|
active: currentPath == 'contacts'
|
||||||
|
}"
|
||||||
|
>
|
||||||
<img src="./assets/img/sidebar/contacts.svg" alt="contacts" /><span
|
<img src="./assets/img/sidebar/contacts.svg" alt="contacts" /><span
|
||||||
>Contacts</span
|
>Contacts</span
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ nav {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.active {
|
||||||
|
background-color: var(--very-dark-blue);
|
||||||
|
}
|
||||||
|
|
||||||
.reference {
|
.reference {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,25 @@
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-sidebar',
|
selector: 'app-sidebar',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [RouterModule],
|
imports: [RouterModule, CommonModule],
|
||||||
templateUrl: './sidebar.component.html',
|
templateUrl: './sidebar.component.html',
|
||||||
styleUrl: './sidebar.component.scss',
|
styleUrl: './sidebar.component.scss',
|
||||||
})
|
})
|
||||||
export class SidebarComponent {}
|
export class SidebarComponent {
|
||||||
|
currentPath: string = '';
|
||||||
|
|
||||||
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.router.events.subscribe((event) => {
|
||||||
|
if (event instanceof NavigationEnd) {
|
||||||
|
this.currentPath = this.router.url.substring(1);
|
||||||
|
console.log(this.currentPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue