aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/app/shared/buttons/action-dropdown.component.ts
blob: 022ab5ee810c3156030c4752ff2d24e47561dd52 (plain) (tree)
1
2
3
4
5
6
7


                                                


                                          
                              










                                                    
                                    
                                                    

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

export type DropdownAction<T> = {
  label?: string
  handler?: (T) => any
  linkBuilder?: (T) => (string | number)[]
  isDisplayed?: (T) => boolean
}

@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
  @Input() placement = 'bottom-left'
  @Input() buttonSize: 'normal' | 'small' = 'normal'
  @Input() label: string
  @Input() theme: 'orange' | 'grey' = 'grey'
}