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=1d2be0bf92060c6d398f542e59accb4362a63ceb;hpb=1fe1e14cb30ac44299563f98ed0aee2805794493;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 1d2be0bf9..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,28 +1,31 @@ -import { Component, Input } from '@angular/core' +import { Component, Input, OnChanges } from '@angular/core' import { GlobalIconName } from '@app/shared/shared-icons' @Component({ selector: 'my-button', - styleUrls: ['./button.component.scss'], + styleUrls: [ './button.component.scss' ], 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 + disabled: this.disabled, + 'icon-only': !this.label, + 'has-icon': !!this.icon, + 'responsive-label': this.responsiveLabel } } }