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


                             






                                                                         
  
                                                    
                        
                        
                                             
                                  
 


                                                  
                                    



                                                 
                                    

     
 
import { Component, Input, OnInit } from '@angular/core'

@Component({
  selector: 'my-edit-button',
  template: `
    <my-button
      icon="edit" className="grey-button-link"
      [label]="label" [title]="title" [responsiveLabel]="responsiveLabel"
      [routerLink]="routerLink"
    ></my-button>
  `
})
export class EditButtonComponent implements OnInit {
  @Input() label: string
  @Input() title: string
  @Input() routerLink: string[] | string = []
  @Input() responsiveLabel = false

  ngOnInit () {
    // <my-edit-button /> No label
    if (this.label === undefined && !this.title) {
      this.title = $localize`Update`
    }

    // <my-edit-button label /> Use default label
    if (this.label === '') {
      this.label = $localize`Update`
    }
  }
}