1
0
Fork 0
peertube/client/src/app/header/suggestion.component.ts

34 lines
795 B
TypeScript
Raw Normal View History

import { ListKeyManagerOption } from '@angular/cdk/a11y'
2020-06-23 12:10:17 +00:00
import { Component, Input, OnInit } from '@angular/core'
import { RouterLink } from '@angular/router'
2020-05-29 14:16:24 +00:00
export type SuggestionPayload = {
text: string
2020-05-29 14:16:24 +00:00
type: SuggestionPayloadType
routerLink?: RouterLink
default: boolean
}
2020-05-29 14:16:24 +00:00
export type SuggestionPayloadType = 'search-instance' | 'search-index'
@Component({
selector: 'my-suggestion',
templateUrl: './suggestion.component.html',
2020-05-29 14:16:24 +00:00
styleUrls: [ './suggestion.component.scss' ]
})
export class SuggestionComponent implements OnInit, ListKeyManagerOption {
2020-05-29 14:16:24 +00:00
@Input() result: SuggestionPayload
@Input() highlight: string
disabled = false
active = false
getLabel () {
return this.result.text
}
ngOnInit () {
if (this.result.default) this.active = true
}
}