-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, EventEmitter, Input, Output } from '@angular/core'
-import { SortField } from '../shared';
+import { SortField } from '../shared'
@Component({
selector: 'my-video-sort',
})
export class VideoSortComponent {
- @Output() sort = new EventEmitter<any>();
+ @Output() sort = new EventEmitter<any>()
- @Input() currentSort: SortField;
+ @Input() currentSort: SortField
- sortChoices = {
+ sortChoices: { [ P in SortField ]: string } = {
'name': 'Name - Asc',
'-name': 'Name - Desc',
'duration': 'Duration - Asc',
'createdAt': 'Created Date - Asc',
'-createdAt': 'Created Date - Desc',
'views': 'Views - Asc',
- '-views': 'Views - Desc'
- };
+ '-views': 'Views - Desc',
+ 'likes': 'Likes - Asc',
+ '-likes': 'Likes - Desc'
+ }
- get choiceKeys() {
- return Object.keys(this.sortChoices);
+ get choiceKeys () {
+ return Object.keys(this.sortChoices)
}
- getStringChoice(choiceKey: SortField) {
- return this.sortChoices[choiceKey];
+ getStringChoice (choiceKey: SortField) {
+ return this.sortChoices[choiceKey]
}
- onSortChange() {
- this.sort.emit(this.currentSort);
+ onSortChange () {
+ this.sort.emit(this.currentSort)
}
}