aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons/button.component.ts
blob: 10d67831f4d8da609df3750da51459c9152f35f3 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                           
                                                         


                        
                                           


                                        
                                                   
                     
                                    
                                           
                                        
                                    
                          
                           
                                  
 



                                         
                             
                              
                               
                              
                                              

     
 
import { Component, Input, OnChanges } from '@angular/core'
import { GlobalIconName } from '@app/shared/shared-icons'

@Component({
  selector: 'my-button',
  styleUrls: [ './button.component.scss' ],
  templateUrl: './button.component.html'
})

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

  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
    }
  }
}