]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/buttons/button.component.ts
Implement two factor in client
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / buttons / button.component.ts
index ee74b3d128cfbb54281fd3badd93e8eea3733863..10d67831f4d8da609df3750da51459c9152f35f3 100644 (file)
@@ -1,4 +1,4 @@
-import { Component, Input } from '@angular/core'
+import { Component, Input, OnChanges } from '@angular/core'
 import { GlobalIconName } from '@app/shared/shared-icons'
 
 @Component({
@@ -7,23 +7,24 @@ import { GlobalIconName } from '@app/shared/shared-icons'
   templateUrl: './button.component.html'
 })
 
-export class ButtonComponent {
+export class ButtonComponent implements OnChanges {
   @Input() label = ''
   @Input() className = 'grey-button'
   @Input() icon: GlobalIconName = undefined
+  @Input() routerLink: string[] | string
   @Input() title: string = undefined
   @Input() loading = false
   @Input() disabled = false
   @Input() responsiveLabel = false
 
-  getTitle () {
-    return this.title || this.label
-  }
+  classes: { [id: string]: boolean } = {}
 
-  getClasses () {
-    return {
+  ngOnChanges () {
+    this.classes = {
       [this.className]: true,
       disabled: this.disabled,
+      'icon-only': !this.label,
+      'has-icon': !!this.icon,
       'responsive-label': this.responsiveLabel
     }
   }