]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/buttons/button.component.html
Refactor button components
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / buttons / button.component.html
index d1a4215e6e481b1533202f7461a1ca983e104a23..c0a4b21b8d93c47a6e06ec70783b5fce4ad28335 100644 (file)
@@ -1,8 +1,16 @@
-<span class="action-button" [ngClass]="getClasses()" [ngbTooltip]="title" tabindex="0">
+<span *ngIf="!routerLink" class="action-button" [ngClass]="getClasses()" [ngbTooltip]="title" tabindex="0">
+  <ng-container *ngTemplateOutlet="content"></ng-container>
+</span>
+
+<a *ngIf="routerLink" class="action-button" [ngClass]="getClasses()" [ngbTooltip]="title" [routerLink]="routerLink">
+  <ng-container *ngTemplateOutlet="content"></ng-container>
+</a>
+
+<ng-template #content>
   <my-small-loader [loading]="loading"></my-small-loader>
   <my-global-icon *ngIf="icon && !loading" [iconName]="icon"></my-global-icon>
 
   <span *ngIf="label" class="button-label">{{ label }}</span>
 
   <ng-content></ng-content>
-</span>
+</ng-template>