Skip to content

Commit 26ea938

Browse files
committed
feat: index new picture placeholders
1 parent 8815675 commit 26ea938

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

src/app/index/pictures/pictures.component.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@ <h4>
33
<ng-container i18n>New pictures</ng-container> <small><a routerLink="/new" i18n>all</a></small>
44
</h4>
55
</div>
6-
<ng-template #loading>
7-
<div class="spinner-border" role="status"><span class="visually-hidden" i18n>Loading…</span></div>
6+
7+
<ng-template #placeholder>
8+
<div class="row placeholder-glow">
9+
<div class="col-6 col-sm-6 col-md-3 col-lg-3" *ngFor="let _ of [].constructor(4)">
10+
<div class="card mb-4">
11+
<div class="placeholder ratio ratio-4x3 card-img-top"></div>
12+
<div class="card-body">
13+
<h6 class="card-title">
14+
<span class="placeholder w-50"></span>
15+
</h6>
16+
<p class="picture-behaviour clearfix">
17+
<span class="placeholder w-50"></span>
18+
<span class="placeholder w-25"></span>
19+
</p>
20+
</div>
21+
</div>
22+
</div>
23+
</div>
824
</ng-template>
925

10-
<div class="row" *ngIf="items$ | async as items; else loading">
26+
<div class="row" *ngIf="items$ | async as items; else placeholder">
1127
<div class="col-6 col-sm-6 col-md-3 col-lg-3" *ngFor="let picture of items">
1228
<app-thumbnail [picture]="picture" [route]="['/picture', picture.identity]"></app-thumbnail>
1329
</div>

src/app/index/pictures/pictures.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Component} from '@angular/core';
22
import {PictureService} from '../../services/picture';
3-
import {map} from 'rxjs/operators';
3+
import {map, delay} from 'rxjs/operators';
44

55
@Component({
66
selector: 'app-index-pictures',
@@ -15,7 +15,10 @@ export class IndexPicturesComponent {
1515
accepted_in_days: 3,
1616
fields: 'owner,thumb_medium,votes,views,comments_count,name_html,name_text',
1717
})
18-
.pipe(map((response) => response.pictures));
18+
.pipe(
19+
delay(5000),
20+
map((response) => response.pictures)
21+
);
1922

2023
constructor(private pictureService: PictureService) {}
2124
}

0 commit comments

Comments
 (0)