aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons/edit-button.component.ts
blob: 850be1decca340ccc8413a83b35532ce181f25ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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"
      [ptRouterLink]="ptRouterLink"
    ></my-button>
  `
})
export class EditButtonComponent implements OnInit {
  @Input() label: string
  @Input() title: string
  @Input() ptRouterLink: 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`
    }
  }
}