aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/buttons/action-dropdown.component.ts
blob: 407d24b80f31f7c321a153bb76bda6bd5fc8495e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { Component, Input } from '@angular/core'

export type DropdownAction<T> = {
  type: 'custom' | 'delete' | 'edit'
  label?: string
  handler?: (T) => any
  linkBuilder?: (T) => (string | number)[]
  iconClass?: string
}

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

export class ActionDropdownComponent<T> {
  @Input() actions: DropdownAction<T>[] = []
  @Input() entry: T
}