Skip to content

Commit

Permalink
done current nav (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
FunixG authored May 8, 2024
1 parent 89b3e8e commit ea2f60d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav align-items-center">
<li class="nav-item">
<a class="nav-link" href="/shop">Boutique</a>
<a class="nav-link {{ currentUrl.startsWith('/shop') ? 'current' : '' }}" href="/shop">Boutique</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/news">News</a>
<a class="nav-link {{ currentUrl.startsWith('/news') ? 'current' : '' }}" href="/news">News</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/wiki">Wiki</a>
<a class="nav-link {{ currentUrl.startsWith('/wiki') ? 'current' : '' }}" href="/wiki">Wiki</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/vote">Vote</a>
<a class="nav-link {{ currentUrl.startsWith('/vote') ? 'current' : '' }}" href="/vote">Vote</a>
</li>

<a class="nav-link" href="/user" rel="nofollow">
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/navbar/navbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ nav a:hover {
font-weight: normal;
color: $secondary_color;
}

nav .current {
color: $main_color;
}
8 changes: 8 additions & 0 deletions src/app/components/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import {Component} from '@angular/core';
import {PlatformLocation} from "@angular/common";

@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent {

currentUrl: string;

constructor(platformLocation: PlatformLocation) {
this.currentUrl = platformLocation.pathname;
}

}

0 comments on commit ea2f60d

Please sign in to comment.