import {Component, EventEmitter, Input, Output} from '@angular/core';
import {Project} from "../../utils/result-preview/result-preview";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'fundedBy',
template: `
`
})
export class FundedByComponent {
@Input() fundedByProjects: Project[];
@Input() viewAll: boolean = false;
@Output() viewAllClicked = new EventEmitter();
public lessBtn: boolean = false;
public threshold: number = 4;
public url = properties.searchLinkToProject.split('?')[0];
public title: string = "Funded by";
public viewAllClick() {
if(this.fundedByProjects.length <= this.threshold*2) {
this.viewAll = true;
this.lessBtn = true;
} else {
this.viewAll = true;
this.viewAllClicked.emit('fundedBy');
}
}
public viewLessClick() {
this.viewAll = false;
this.viewAllClicked.emit("");
}
}