Skip to content

Commit

Permalink
fix(tab): add routerLink only for url
Browse files Browse the repository at this point in the history
  • Loading branch information
marcjulian committed May 3, 2020
1 parent e2fc2b1 commit 2af58f5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 23 additions & 5 deletions projects/components/src/lib/tab/tab.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
<a class="h-full w-full flex flex-col items-center justify-center hover:text-blue" [class.hover:text-color]="tab.logo"
[routerLink]="tab.url" [routerLinkActive]="tab.routeActive ? 'active-tab' : ''">
<ng-container *ngIf="tab.url; else withoutUrl">
<a class="h-full w-full flex flex-col items-center justify-center hover:text-blue" [class.hover:text-color]="tab.logo"
[routerLink]="tab.url" [routerLinkActive]="tab.routeActive ? 'active-tab' : ''">
<ng-container *ngTemplateOutlet="tabContent"></ng-container>
</a>
<ng-container *ngTemplateOutlet="tooltip"></ng-container>
</ng-container>

<ng-template #withoutUrl>
<a class="h-full w-full flex flex-col items-center justify-center hover:text-blue"
[class.hover:text-color]="tab.logo">
<ng-container *ngTemplateOutlet="tabContent"></ng-container>
</a>
<ng-container *ngTemplateOutlet="tooltip"></ng-container>
</ng-template>

<ng-template #tabContent>
<niz-inline-svg class="h-8 w-8" [svgSource]="tab.image"></niz-inline-svg>
<span *ngIf="tab.text && !tab.tooltip" class="mt-1 text-lg font-semibold tracking-tight">{{tab.text}}</span>
</a>
<span *ngIf="tab.text && tab.tooltip"
class="tooltip text-color bg-tabs rounded-full py-1 px-4 hidden md:block">{{tab.text}}</span>
</ng-template>

<ng-template #tooltip>
<span *ngIf="tab.text && tab.tooltip"
class="tooltip text-color bg-tabs rounded-full py-1 px-4 hidden md:block">{{tab.text}}</span>
</ng-template>

0 comments on commit 2af58f5

Please sign in to comment.