]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/header/suggestion.component.ts
Translated using Weblate (Spanish)
[github/Chocobozzz/PeerTube.git] / client / src / app / header / suggestion.component.ts
CommitLineData
6af662a5 1import { ListKeyManagerOption } from '@angular/cdk/a11y'
67ed6552
C
2import { Component, Input, OnInit } from '@angular/core'
3import { RouterLink } from '@angular/router'
6af662a5 4
5fb2e288 5export type SuggestionPayload = {
6af662a5 6 text: string
5fb2e288
C
7 type: SuggestionPayloadType
8 routerLink?: RouterLink
9 default: boolean
6af662a5
RK
10}
11
5fb2e288
C
12export type SuggestionPayloadType = 'search-instance' | 'search-index'
13
6af662a5
RK
14@Component({
15 selector: 'my-suggestion',
16 templateUrl: './suggestion.component.html',
5fb2e288 17 styleUrls: [ './suggestion.component.scss' ]
6af662a5
RK
18})
19export class SuggestionComponent implements OnInit, ListKeyManagerOption {
5fb2e288 20 @Input() result: SuggestionPayload
6af662a5 21 @Input() highlight: string
6af662a5 22
6af662a5
RK
23 disabled = false
24 active = false
25
6af662a5
RK
26 getLabel () {
27 return this.result.text
28 }
29
30 ngOnInit () {
52cc0d54 31 if (this.result.default) this.active = true
6af662a5 32 }
6af662a5 33}