feat(aio): about/contributor page rebased and tweaked
This commit is contained in:
parent
baecb553a6
commit
f5d0fac800
|
@ -68,7 +68,7 @@
|
||||||
"twitter": "ThomasBurleson",
|
"twitter": "ThomasBurleson",
|
||||||
"website": "http://www.solutionOptimist.com",
|
"website": "http://www.solutionOptimist.com",
|
||||||
"bio": "AngularJS Material and @angular/flex-layout Team Lead. Thomas joined the core team in 2014. He leads a team of developers working on UX components for AngularJS.",
|
"bio": "AngularJS Material and @angular/flex-layout Team Lead. Thomas joined the core team in 2014. He leads a team of developers working on UX components for AngularJS.",
|
||||||
"group": "Lead"
|
"group": "Angular"
|
||||||
},
|
},
|
||||||
"stephenfluin": {
|
"stephenfluin": {
|
||||||
"name": "Stephen Fluin",
|
"name": "Stephen Fluin",
|
||||||
|
|
|
@ -1,22 +1,40 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
|
||||||
|
|
||||||
import { ContributorGroup } from './contributors.model';
|
import { ContributorGroup } from './contributors.model';
|
||||||
import { ContributorService } from './contributor.service';
|
import { ContributorService } from './contributor.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'aio-contributor-list',
|
selector: `aio-contributor-list`,
|
||||||
template: `
|
template: `
|
||||||
<section *ngFor="let group of groups | async" class="grid-fluid">
|
<div class="flex-center group-buttons">
|
||||||
<h4 class="title">{{group.name}}</h4>
|
<a *ngFor="let name of groupNames"
|
||||||
<aio-contributor *ngFor="let person of group.contributors" [person]="person"></aio-contributor>
|
[class.selected]="name == selectedGroup.name"
|
||||||
|
class="button mat-button filter-button"
|
||||||
|
(click)="selectGroup(name)">{{name}}</a>
|
||||||
|
</div>
|
||||||
|
<section *ngIf="selectedGroup" class="grid-fluid">
|
||||||
|
<div class="contributor-group">
|
||||||
|
<aio-contributor *ngFor="let person of selectedGroup.contributors" [person]="person"></aio-contributor>
|
||||||
|
</div>
|
||||||
</section>`
|
</section>`
|
||||||
})
|
})
|
||||||
export class ContributorListComponent {
|
export class ContributorListComponent implements OnInit {
|
||||||
groups: Observable<ContributorGroup[]>;
|
private groups: ContributorGroup[];
|
||||||
|
groupNames: string[];
|
||||||
|
selectedGroup: ContributorGroup;
|
||||||
|
|
||||||
constructor(private contributorService: ContributorService) {
|
constructor(private contributorService: ContributorService) { }
|
||||||
this.groups = this.contributorService.contributors;
|
|
||||||
|
ngOnInit() {
|
||||||
|
// no need to unsubscribe because `contributors` completes
|
||||||
|
this.contributorService.contributors
|
||||||
|
.subscribe(grps => {
|
||||||
|
this.groups = grps;
|
||||||
|
this.groupNames = grps.map(g => g.name);
|
||||||
|
this.selectGroup(grps[0].name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
selectGroup(name) {
|
||||||
|
this.selectedGroup = this.groups.find(g => g.name === name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import { Contributor } from './contributors.model';
|
||||||
<span class="fa fa-link fa-2x"></span>
|
<span class="fa fa-link fa-2x"></span>
|
||||||
</a>
|
</a>
|
||||||
<div>
|
<div>
|
||||||
<a *ngIf="person.bio" aria-label="View Bio" (click)="flipCard(person)">View Bio</a>
|
<a *ngIf="person.bio" aria-label="View Bio">View Bio</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,15 +56,15 @@ describe('ContributorService', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should reshape the contributor json to expected result', () => {
|
it('should reshape the contributor json to expected result', () => {
|
||||||
const groupNames = contribs.map(g => g.name);
|
const groupNames = contribs.map(g => g.name).join(',');
|
||||||
expect(groupNames).toEqual(['Lead', 'Google', 'Community']);
|
expect(groupNames).toEqual('Angular,Community');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have expected "Lead" contribs in order', () => {
|
it('should have expected "Community" contribs in order', () => {
|
||||||
const leads = contribs[0];
|
const community = contribs[1];
|
||||||
const actualLeadNames = leads.contributors.map(l => l.name).join(',');
|
const actualAngularNames = community.contributors.map(l => l.name).join(',');
|
||||||
const expectedLeadNames = [testData.igor, testData.misko, testData.naomi].map(l => l.name).join(',');
|
const expectedAngularNames = [testData.jeffcross, testData.kapunahelewong].map(l => l.name).join(',');
|
||||||
expect(actualLeadNames).toEqual(expectedLeadNames);
|
expect(actualAngularNames).toEqual(expectedAngularNames);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -74,29 +74,37 @@ describe('ContributorService', () => {
|
||||||
function getTestContribs() {
|
function getTestContribs() {
|
||||||
// tslint:disable:quotemark
|
// tslint:disable:quotemark
|
||||||
return {
|
return {
|
||||||
|
"kapunahelewong": {
|
||||||
|
"name": "Kapunahele Wong",
|
||||||
|
"picture": "kapunahelewong.jpg",
|
||||||
|
"website": " https://github.com/kapunahelewong",
|
||||||
|
"twitter": "kapunahele",
|
||||||
|
"bio": "Kapunahele is a front-end developer and contributor to angular.io",
|
||||||
|
"group": "Community"
|
||||||
|
},
|
||||||
"misko": {
|
"misko": {
|
||||||
"name": "Miško Hevery",
|
"name": "Miško Hevery",
|
||||||
"picture": "misko.jpg",
|
"picture": "misko.jpg",
|
||||||
"twitter": "mhevery",
|
"twitter": "mhevery",
|
||||||
"website": "http://misko.hevery.com",
|
"website": "http://misko.hevery.com",
|
||||||
"bio": "Miško Hevery is the creator of AngularJS framework.",
|
"bio": "Miško Hevery is the creator of AngularJS framework.",
|
||||||
"group": "Lead"
|
"group": "Angular"
|
||||||
},
|
},
|
||||||
"igor": {
|
"igor": {
|
||||||
"name": "Igor Minar",
|
"name": "Igor Minar",
|
||||||
"picture": "igor-minar.jpg",
|
"picture": "igor-minar.jpg",
|
||||||
"twitter": "IgorMinar",
|
"twitter": "IgorMinar",
|
||||||
"website": "https://google.com/+IgorMinar",
|
"website": "https://Angular.com/+IgorMinar",
|
||||||
"bio": "Igor is a software engineer at Google.",
|
"bio": "Igor is a software engineer at Angular.",
|
||||||
"group": "Lead"
|
"group": "Angular"
|
||||||
},
|
},
|
||||||
"kara": {
|
"kara": {
|
||||||
"name": "Kara Erickson",
|
"name": "Kara Erickson",
|
||||||
"picture": "kara-erickson.jpg",
|
"picture": "kara-erickson.jpg",
|
||||||
"twitter": "karaforthewin",
|
"twitter": "karaforthewin",
|
||||||
"website": "https://github.com/kara",
|
"website": "https://github.com/kara",
|
||||||
"bio": "Kara is a software engineer on the Angular team at Google and a co-organizer of the Angular-SF Meetup. ",
|
"bio": "Kara is a software engineer on the Angular team at Angular and a co-organizer of the Angular-SF Meetup. ",
|
||||||
"group": "Google"
|
"group": "Angular"
|
||||||
},
|
},
|
||||||
"jeffcross": {
|
"jeffcross": {
|
||||||
"name": "Jeff Cross",
|
"name": "Jeff Cross",
|
||||||
|
@ -110,9 +118,9 @@ function getTestContribs() {
|
||||||
"name": "Naomi Black",
|
"name": "Naomi Black",
|
||||||
"picture": "naomi.jpg",
|
"picture": "naomi.jpg",
|
||||||
"twitter": "naomitraveller",
|
"twitter": "naomitraveller",
|
||||||
"website": "http://google.com/+NaomiBlack",
|
"website": "http://Angular.com/+NaomiBlack",
|
||||||
"bio": "Naomi is Angular's TPM generalist and jack-of-all-trades.",
|
"bio": "Naomi is Angular's TPM generalist and jack-of-all-trades.",
|
||||||
"group": "Lead"
|
"group": "Angular"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { Logger } from 'app/shared/logger.service';
|
||||||
import { Contributor, ContributorGroup } from './contributors.model';
|
import { Contributor, ContributorGroup } from './contributors.model';
|
||||||
|
|
||||||
const contributorsPath = 'content/contributors.json';
|
const contributorsPath = 'content/contributors.json';
|
||||||
const knownGroups = ['Lead', 'Google', 'Community'];
|
const knownGroups = ['Angular', 'Community'];
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ContributorService {
|
export class ContributorService {
|
||||||
|
|
Loading…
Reference in New Issue