Skip to content

Commit

Permalink
feat: add header links (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc authored Aug 4, 2019
1 parent 4a8cb85 commit 8547306
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NavigationBarComponent } from './navigation-bar/navigation-bar.componen
import { RouterModule } from '@angular/router';
import { SharedModule } from '@app/shared/shared.module';
import { FooterComponent } from './footer/footer.component';
import { TooltipModule } from 'ngx-bootstrap/tooltip';

@NgModule({
declarations: [
Expand All @@ -14,6 +15,8 @@ import { FooterComponent } from './footer/footer.component';
CommonModule,
RouterModule,
SharedModule,

TooltipModule,
],
exports: [
NavigationBarComponent,
Expand Down
13 changes: 13 additions & 0 deletions src/app/core/navigation-bar/navigation-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
<li class="nav-item">
<a class="nav-link" routerLink="/rules" routerLinkActive="active">rules</a>
</li>

<ng-container *ngFor="let link of links">
<a [href]="link.target" target="_blank"
[ngClass]="link.icon ? 'navbar-brand' : 'nav-link'">
<img *ngIf="link.icon; else text"
[src]="link.icon"
[attr.alt]="link.name"
[tooltip]="link.tooltip"
width="30" height="30"
class="d-inline-block align-top mx-1">
<ng-template #text>{{ link.name }}</ng-template>
</a>
</ng-container>
</ul>

<div class="navbar-text">
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/navigation-bar/navigation-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AuthService } from '@app/auth/auth.service';
import { Store } from '@ngrx/store';
import { AppState } from '@app/app.state';
import { profile } from '@app/profile/profile.selectors';
import { environment } from '@environment';

@Component({
selector: 'app-navigation-bar',
Expand All @@ -14,6 +15,7 @@ export class NavigationBarComponent {

isAuthenticated = this.authService.authenticated;
profile = this.store.select(profile);
links = environment.headerLinks;

constructor(
private authService: AuthService,
Expand Down
1 change: 1 addition & 0 deletions src/assets/discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@

import { version } from 'package.json';

const discordInvitation = 'https://discord.gg/YsAAAz';

export const environment = {
production: false,
apiUrl: '/api', // goes via local proxy
wsUrl: '/',
version,
headerLinks: [
{ name: 'discord', icon: '/assets/discord.svg', target: discordInvitation, tooltip: 'Join us on discord!' },
],
footerLinks: [
{ name: 'github', target: 'https://github.com/tf2pickup-pl' },
{ name: 'discord', target: 'https://discord.gg/YsAAAz' },
{ name: 'discord', target: discordInvitation },
],
};

Expand Down

0 comments on commit 8547306

Please sign in to comment.