|
1 | 1 | <div class="grid-wrapper" [class.max-items-4]="(totalElements$ | async) < 4"> |
2 | 2 | <ng-container *ngFor="let item of (searchResultArray$ | async); let i = index; let last = last"> |
3 | | - <ng-container *ngIf="isBrowser && !isLoading; else imageSkeleton"> |
4 | | - <img [src]="(itemToImageHrefMap$ | async)?.get(item.uuid)" alt="hidden-image" style="display: none" #image> |
5 | | - <div class="thumbnail-container" |
6 | | - [class.landscape]="(totalElements$ | async) > 6 && image.naturalWidth > maxSquareRatio * image.naturalHeight" |
7 | | - [class.portrait]="(totalElements$ | async) > 6 && image.naturalHeight > maxSquareRatio * image.naturalWidth"> |
8 | | - <div class="thumbnail-inner-container w-100 h-100 position-relative" |
9 | | - [dsBackgroundImage]="(itemToImageHrefMap$ | async)?.get(item.uuid)"> |
10 | | - <ds-type-badge [object]="item"></ds-type-badge> |
11 | | - <a [routerLink]="[getItemPageRoute(item)]" class="h-100 mw-100 p-3"> |
12 | | - <p class="h4 text-center m-0">{{ item.firstMetadataValue('dc.title') }}</p> |
13 | | - </a> |
| 3 | + @defer { |
| 4 | + @if (!isLoading) { |
| 5 | + <img [src]="(itemToImageHrefMap$ | async)?.get(item.uuid)" alt="hidden-image" style="display: none" #image> |
| 6 | + <div class="thumbnail-container" |
| 7 | + [class.landscape]="(totalElements$ | async) > 6 && image.naturalWidth > maxSquareRatio * image.naturalHeight" |
| 8 | + [class.portrait]="(totalElements$ | async) > 6 && image.naturalHeight > maxSquareRatio * image.naturalWidth"> |
| 9 | + <div class="thumbnail-inner-container w-100 h-100 position-relative" |
| 10 | + [dsBackgroundImage]="(itemToImageHrefMap$ | async)?.get(item.uuid)"> |
| 11 | + <ds-type-badge [object]="item"></ds-type-badge> |
| 12 | + <a [routerLink]="[getItemPageRoute(item)]" class="h-100 mw-100 p-3"> |
| 13 | + <p class="h4 text-center m-0">{{ item.firstMetadataValue('dc.title') }}</p> |
| 14 | + </a> |
| 15 | + </div> |
14 | 16 | </div> |
15 | | - </div> |
| 17 | + } @else { |
| 18 | + <ng-container *ngTemplateOutlet="imageSkeleton"></ng-container> |
| 19 | + } |
| 20 | + } @placeholder { |
| 21 | + <ng-container *ngTemplateOutlet="imageSkeleton"></ng-container> |
| 22 | + } |
16 | 23 | </ng-container> |
17 | 24 | <ng-template #imageSkeleton> |
18 | 25 | <ngx-skeleton-loader class="thumbnail-container w-100 h-100" [theme]="{height: '100%', width: '100%'}"></ngx-skeleton-loader> |
19 | 26 | </ng-template> |
20 | | - </ng-container> |
21 | 27 | </div> |
0 commit comments