move all the code into the child components

pull/9/head
Chris Veilleux 2018-10-22 21:45:08 -05:00
parent a160c5331a
commit f15249c6db
3 changed files with 0 additions and 79 deletions

View File

@ -1,7 +0,0 @@
<market-skill-toolbar (searchResults)="showSearchResults($event)"></market-skill-toolbar>
<div class="skill-category" *ngFor="let category of skillCategories">
<mat-toolbar align="center">
{{category}}
</mat-toolbar>
<market-skill-summary [skills]="skills[category]"></market-skill-summary>
</div>

View File

@ -1,15 +0,0 @@
@import '../../stylesheets/global';
.skill-category {
background-color: $market-background;
mat-toolbar {
background-color: $market-background;
color: $mycroft-dark-grey;
font-size: xx-large;
margin-top: 20px;
padding-left: 10px;
fa-icon {
margin-right: 15px;
}
}
}

View File

@ -1,57 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { SkillsService } from './skills.service'
@Component({
selector: 'marketplace-skills',
templateUrl: './skills.component.html',
styleUrls: ['./skills.component.scss']
})
export class SkillsComponent implements OnInit {
public skillCategories: string[];
public skills: Object;
constructor(private skillsService: SkillsService) { }
ngOnInit() {
this.getAllSkills();
}
getAllSkills(): void {
this.skillsService.getAllSkills().subscribe(
(skills) => {
this.skills = skills;
this.get_skill_categories(skills);
}
)
}
get_skill_categories(skills): void {
let skillCategories = [],
systemCategoryFound = false;
this.skillCategories = [];
Object.keys(skills).forEach(
categoryName => {skillCategories.push(categoryName);}
);
skillCategories.sort();
// Make the "System" category display last, if it exists
skillCategories.forEach(
categoryName => {
if (categoryName === 'System') {
systemCategoryFound = true;
} else {
this.skillCategories.push(categoryName)
}
}
);
if (systemCategoryFound) {
this.skillCategories.push('System')
}
}
showSearchResults(searchResults): void {
this.skills = searchResults;
this.get_skill_categories(searchResults)
}
}