]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/buttons/action-dropdown.component.ts
Add/update/delete/list my playlists
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / buttons / action-dropdown.component.ts
index 407d24b80f31f7c321a153bb76bda6bd5fc8495e..275e2b51ecfbabd82e4816b18c3414f8e9a60dd7 100644 (file)
@@ -1,11 +1,10 @@
 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
+  handler?: (a: T) => any
+  linkBuilder?: (a: T) => (string | number)[]
+  isDisplayed?: (a: T) => boolean
 }
 
 @Component({
@@ -15,6 +14,16 @@ export type DropdownAction<T> = {
 })
 
 export class ActionDropdownComponent<T> {
-  @Input() actions: DropdownAction<T>[] = []
+  @Input() actions: DropdownAction<T>[] | DropdownAction<T>[][] = []
   @Input() entry: T
+  @Input() placement = 'bottom-left'
+  @Input() buttonSize: 'normal' | 'small' = 'normal'
+  @Input() label: string
+  @Input() theme: 'orange' | 'grey' = 'grey'
+
+  getActions () {
+    if (this.actions.length !== 0 && Array.isArray(this.actions[0])) return this.actions
+
+    return [ this.actions ]
+  }
 }