Add videos count in channels list
[oweals/peertube.git] / client / src / app / header / suggestion.component.ts
1 import { Input, Component, Output, EventEmitter, OnInit, ChangeDetectionStrategy, OnChanges } from '@angular/core'
2 import { RouterLink } from '@angular/router'
3 import { ListKeyManagerOption } from '@angular/cdk/a11y'
4
5 export type SuggestionPayload = {
6   text: string
7   type: SuggestionPayloadType
8   routerLink?: RouterLink
9   default: boolean
10 }
11
12 export type SuggestionPayloadType = 'search-instance' | 'search-index'
13
14 @Component({
15   selector: 'my-suggestion',
16   templateUrl: './suggestion.component.html',
17   styleUrls: [ './suggestion.component.scss' ]
18 })
19 export class SuggestionComponent implements OnInit, ListKeyManagerOption {
20   @Input() result: SuggestionPayload
21   @Input() highlight: string
22
23   disabled = false
24   active = false
25
26   getLabel () {
27     return this.result.text
28   }
29
30   ngOnInit () {
31     if (this.result.default) this.active = true
32   }
33 }