-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): items component initial implementation
- Loading branch information
1 parent
09b7b01
commit db70e54
Showing
6 changed files
with
90 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {Component, Input} from 'angular2/core'; | ||
import {NgIf} from 'angular2/common'; | ||
|
||
import {DDragonDirective} from '../../misc/ddragon.directive'; | ||
|
||
@Component({ | ||
selector: 'item', | ||
directives: [NgIf, DDragonDirective], | ||
template: ` | ||
<img [ddragon]="'item/' + item.image.full"> | ||
<div> | ||
<p *ngIf="name" class="name">{{name}}</p> | ||
<div class="gold"> | ||
<img [ddragon]="'ui/gold.png'"> | ||
<p>{{item.gold.total}}</p> | ||
</div> | ||
</div>` | ||
}) | ||
|
||
export class ItemComponent { | ||
@Input() item; | ||
@Input() name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {Component, Input, OnChanges} from 'angular2/core'; | ||
import {NgFor, NgClass} from 'angular2/common'; | ||
|
||
import {ItemComponent} from './item.component.ts'; | ||
|
||
import {ToIterablePipe} from '../../misc/to-iterable.pipe'; | ||
|
||
@Component({ | ||
selector: 'items', | ||
directives: [NgFor, NgClass, ItemComponent], | ||
pipes: [ToIterablePipe], | ||
template: ` | ||
<template ngFor #item [ngForOf]="items?.data | toIterable"> | ||
<item [item]="item" [ngClass]="{disabled: item.disabled}" [attr.title]="item.description"></item> | ||
</template>` | ||
}) | ||
|
||
export class ItemsComponent implements OnChanges { | ||
@Input() items; | ||
|
||
ngOnChanges() { | ||
// TODO: implement | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters