Skip to content

Commit 4ebf520

Browse files
authored
Merge pull request #5 from kidshenlong/image-holder
Updating stacks with place holder while loading.
2 parents 27a33e5 + a26a472 commit 4ebf520

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

app/library/library.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--<div class="shelf" ng2FileDrop [uploader]="uploadService.uploader" (fileOver)="fileOver($event)" [class.transparent]="isTransparent">-->
22
<div class="shelf" (fileOver)="fileOver($event)" [class.transparent]="isTransparent">
3-
<stack *ngFor="let thisSeries of series" [stackType]="'series'" [stackData]="thisSeries"></stack>
3+
<stack *ngFor="let thisSeries of series" [stackType]="'series'" [stackData]="thisSeries" [stackImage]="thisSeries.cover_image"></stack>
44
</div>
55

66

app/series/series.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<stack *ngFor="let comic of comics" [stackType]="'comic'" [stackData]="comic"></stack>
1+
<stack *ngFor="let comic of comics" [stackType]="'comic'" [stackData]="comic" [stackImage]="comic.comic_book_archive_contents[0]"></stack>

app/shared/stack/stack.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<a [routerLink]="['/' + stackType, stackData.id]">
2-
<img *ngIf="stackType=='series'" [src]="stackData.cover_image">
3-
<img *ngIf="stackType=='comic'" [src]="stackData.comic_book_archive_contents[0]">
2+
<img [hidden]="!isStackImageLoaded" [src]="stackImage" (load)="stackImageLoaded($event)">
3+
<img *ngIf="!isStackImageLoaded" src="/images/comic-cloud-image-holder.png">
44
<div class="information" *ngIf="stackType=='series'">{{stackData.title}} ({{stackData.start_year}})</div>
55
<div class="information" *ngIf="stackType=='comic'" >#{{stackData.issue}}</div>
66
</a>

app/shared/stack/stack.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,12 @@ export class StackComponent {
1414
//@Input() //Declares a data-bound input property.
1515
@Input() stackData: string[];//todo this type should ideally be an abstract class that all stack types (ie comic, series, reading list) implement
1616
@Input() stackType: string;
17+
@Input() stackImage: string;
1718

19+
isStackImageLoaded: boolean = false;
20+
21+
stackImageLoaded(event){
22+
this.isStackImageLoaded = true;
23+
console.log(event);
24+
}
1825
}

images/comic-cloud-image-holder.png

10.3 KB
Loading

0 commit comments

Comments
 (0)