]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-main/buttons/button.component.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / buttons / button.component.ts
1 import { ChangeDetectionStrategy, Component, Input, OnChanges } from '@angular/core'
2 import { GlobalIconName } from '@app/shared/shared-icons'
3
4 @Component({
5 selector: 'my-button',
6 styleUrls: [ './button.component.scss' ],
7 templateUrl: './button.component.html',
8 changeDetection: ChangeDetectionStrategy.OnPush
9 })
10
11 export class ButtonComponent implements OnChanges {
12 @Input() label = ''
13 @Input() className = 'grey-button'
14 @Input() icon: GlobalIconName = undefined
15 @Input() routerLink: string[] | string
16 @Input() title: string = undefined
17 @Input() loading = false
18 @Input() disabled = false
19 @Input() responsiveLabel = false
20
21 classes: { [id: string]: boolean } = {}
22
23 ngOnChanges () {
24 this.classes = {
25 [this.className]: true,
26 disabled: this.disabled,
27 'icon-only': !this.label,
28 'has-icon': !!this.icon,
29 'responsive-label': this.responsiveLabel
30 }
31 }
32 }