Skip to content

Commit

Permalink
fix: Enable default link behaviors on nav bar and side nav links
Browse files Browse the repository at this point in the history
  • Loading branch information
romeonicholas committed Nov 10, 2023
1 parent 028853a commit 22640bf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 34 deletions.
7 changes: 0 additions & 7 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
"schematics": {
"@schematics/angular:application": {
"strict": true
},
"@schematics/angular:component": {
"skipTests": true,
"style": "none"
},
"@schematics/angular:service": {
"skipTests": true
}
},
"root": "",
Expand Down
32 changes: 19 additions & 13 deletions frontend/src/app/general/header/header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@
</div>

<div class="hidden gap-2 xl:flex">
<div
*ngFor="let item of navBarService.navBarItems"
[routerLink]="item.routerLink"
>
<a
mat-raised-button
color="primary"
*ngIf="userService.validateUserRole(item.requiredRole)"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }} <mat-icon *ngIf="item.icon">{{ item.icon }}</mat-icon>
</a>
<div *ngFor="let item of navBarService.navBarItems">
<ng-container *ngIf="userService.validateUserRole(item.requiredRole)">
<ng-container *ngIf="item.href; else router">
<a
mat-raised-button
color="primary"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }}
<mat-icon *ngIf="item.icon">{{ item.icon }}</mat-icon>
</a>
</ng-container>
<ng-template #router>
<a mat-raised-button color="primary" [routerLink]="item.routerLink">
{{ item.name }}
</a>
</ng-template>
</ng-container>
</div>
</div>
<div>
Expand Down
38 changes: 24 additions & 14 deletions frontend/src/app/general/nav-bar-menu/nav-bar-menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,30 @@

<mat-list>
<div *ngFor="let item of navBarService.navBarItems">
<div [routerLink]="item.routerLink">
<a
mat-list-item
(click)="navBarService.toggle()"
*ngIf="userService.validateUserRole(item.requiredRole)"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }}
<mat-icon class="open-in-new" *ngIf="item.icon">{{
item.icon
}}</mat-icon>
</a>
</div>
<ng-container *ngIf="userService.validateUserRole(item.requiredRole)">
<ng-container *ngIf="item.href; else router">
<a
mat-list-item
(click)="navBarService.toggle()"
[attr.href]="item.href"
[attr.target]="item.target"
>
{{ item.name }}
<mat-icon class="open-in-new" *ngIf="item.icon">{{
item.icon
}}</mat-icon>
</a>
</ng-container>
<ng-template #router>
<a
mat-list-item
(click)="navBarService.toggle()"
[routerLink]="item.routerLink"
>
{{ item.name }}
</a>
</ng-template>
</ng-container>
<mat-divider></mat-divider>
</div>
<mat-divider></mat-divider>
Expand Down

0 comments on commit 22640bf

Please sign in to comment.