X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fbuttons%2Fbutton.component.ts;h=10d67831f4d8da609df3750da51459c9152f35f3;hb=d12b40fb96d56786a96c06a621f3d8e0a0d24f4a;hp=52936a4d47076b4873ea5087efe037e4d70c49b6;hpb=0164fc112a98897849a8eda2f0b5d208e813e014;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/buttons/button.component.ts b/client/src/app/shared/shared-main/buttons/button.component.ts index 52936a4d4..10d67831f 100644 --- a/client/src/app/shared/shared-main/buttons/button.component.ts +++ b/client/src/app/shared/shared-main/buttons/button.component.ts @@ -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,20 +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 - getClasses () { - return { + classes: { [id: string]: boolean } = {} + + ngOnChanges () { + this.classes = { [this.className]: true, disabled: this.disabled, 'icon-only': !this.label, + 'has-icon': !!this.icon, 'responsive-label': this.responsiveLabel } }