|
1 | | -<ngb-carousel #carousel [interval]="2000" (slide)="onSlide($event)" class="ds-carousel"> |
2 | | - <ng-template ngbSlide *ngFor="let item of items; let i = index; let last = last"> |
3 | | - <ng-container *ngIf="getItemLink(item.indexableObject); let currentLink; else carouselContent"> |
4 | | - <a *ngIf="isLinkInternal(currentLink)" [routerLink]="currentLink"> |
5 | | - <ng-container *ngTemplateOutlet="carouselContent"></ng-container> |
6 | | - </a> |
7 | | - <a *ngIf="!isLinkInternal(currentLink)" [href]="currentLink" [target]="carouselOptions.targetBlank ? '_blank' : null"> |
8 | | - <ng-container *ngTemplateOutlet="carouselContent"></ng-container> |
9 | | - </a> |
10 | | - </ng-container> |
11 | | - <ng-template #carouselContent> |
12 | | - <div class="carousel-content-wrapper" |
13 | | - [ngStyle]="{ |
| 1 | +<div *ngIf="!(isLoading$ | async) && itemList?.length > 0"> |
| 2 | + <ngb-carousel #carousel [interval]="2000" (slide)="onSlide($event)" class="ds-carousel"> |
| 3 | + <ng-template ngbSlide *ngFor="let item of currentPageItems(); let i = index; let last = last"> |
| 4 | + <ng-container *ngIf="getItemLink(item.indexableObject); let currentLink; else carouselContent"> |
| 5 | + <a *ngIf="isLinkInternal(currentLink)" [routerLink]="currentLink"> |
| 6 | + <ng-container *ngTemplateOutlet="carouselContent"></ng-container> |
| 7 | + </a> |
| 8 | + <a *ngIf="!isLinkInternal(currentLink)" [href]="currentLink" [target]="carouselOptions.targetBlank ? '_blank' : null"> |
| 9 | + <ng-container *ngTemplateOutlet="carouselContent"></ng-container> |
| 10 | + </a> |
| 11 | + </ng-container> |
| 12 | + <ng-template #carouselContent> |
| 13 | + <div class="carousel-content-wrapper" |
| 14 | + [ngStyle]="{ |
14 | 15 | 'height': carouselOptions.keepAspectRatio ? null : carouselOptions.carouselHeightPx + 'px', |
15 | 16 | 'aspect-ratio': carouselOptions.keepAspectRatio ? carouselOptions.aspectRatio : null |
16 | 17 | }"> |
17 | | - <div class="picsum-img-wrapper" *ngIf="(itemToImageHrefMap$ | async).get(item.indexableObject.uuid); let href"> |
18 | | - <img [src]="href" [alt]="item.indexableObject.metadata[title][0].value" class="img-fluid" |
19 | | - [ngClass]="{'w-100': carouselOptions.fitWidth, 'h-100': carouselOptions.fitHeight}"> |
20 | | - </div> |
21 | | - <div class="carousel-caption"> |
22 | | - <div class="carousel-caption-inner"> |
23 | | - <h3 data-test="carouselObjTitle" [class]="carouselOptions.titleStyle" |
24 | | - *ngIf="item.indexableObject.metadata[title]"> |
25 | | - {{item.indexableObject.metadata[title][0].value}}</h3> |
26 | | - <div data-test="carouselObjDesc" class="carousel-caption-text pr-3 pl-2" [class]="carouselOptions.captionStyle" |
27 | | - *ngIf="item.indexableObject.metadata[description]; let descriptionObj"> |
28 | | - {{descriptionObj[0].value}} |
| 18 | + <div class="picsum-img-wrapper" *ngIf="(itemToImageHrefMap$ | async).get(item.indexableObject.uuid); let href"> |
| 19 | + <img [src]="href" [alt]="item.indexableObject.metadata[title][0].value" class="img-fluid" |
| 20 | + [ngClass]="{'w-100': carouselOptions.fitWidth, 'h-100': carouselOptions.fitHeight}"> |
| 21 | + </div> |
| 22 | + <div class="carousel-caption"> |
| 23 | + <div class="carousel-caption-inner"> |
| 24 | + <h3 data-test="carouselObjTitle" [class]="carouselOptions.titleStyle" |
| 25 | + *ngIf="item.indexableObject.metadata[title]"> |
| 26 | + {{item.indexableObject.metadata[title][0].value}}</h3> |
| 27 | + <div data-test="carouselObjDesc" class="carousel-caption-text pr-3 pl-2" [class]="carouselOptions.captionStyle" |
| 28 | + *ngIf="item.indexableObject.metadata[description]; let descriptionObj"> |
| 29 | + {{descriptionObj[0].value}} |
| 30 | + </div> |
29 | 31 | </div> |
30 | 32 | </div> |
31 | 33 | </div> |
32 | | - </div> |
| 34 | + </ng-template> |
33 | 35 | </ng-template> |
34 | | - </ng-template> |
35 | | -</ngb-carousel> |
36 | | -<div class="text-center play-pause-button"> |
37 | | - <button type="button" class="btn btn-sm toggle-paused" (click)="togglePaused()"> |
38 | | - <i class="fas fa-play" *ngIf="paused"></i> |
39 | | - <i class="fas fa-pause" *ngIf="!paused"></i> |
40 | | - </button> |
| 36 | + </ngb-carousel> |
| 37 | + <div class="text-center play-pause-button"> |
| 38 | + <button type="button" class="btn btn-sm toggle-paused" (click)="togglePaused()"> |
| 39 | + <i class="fas fa-play" *ngIf="paused"></i> |
| 40 | + <i class="fas fa-pause" *ngIf="!paused"></i> |
| 41 | + </button> |
| 42 | + </div> |
| 43 | + <div class="mt-4 w-100 d-flex justify-content-center align-items-center" *ngIf="totalPages > 1"> |
| 44 | + <button (click)="previousPage()" [disabled]="currentPage === 1" class="prev"> |
| 45 | + <i class="fa fa-arrow-left"></i> |
| 46 | + </button> |
| 47 | + <button |
| 48 | + *ngFor="let page of pages()" |
| 49 | + class="number" |
| 50 | + (click)="changePage(page)" |
| 51 | + style="border: none; background: none; margin: 0 5px" |
| 52 | + [style.color]="page === currentPage ? '#000000' : '#7c7c7c'"> |
| 53 | + {{ page < 10 ? '0' + page : page }} |
| 54 | + </button> |
| 55 | + <button (click)="nextPage()" [disabled]="currentPage === pages().length" class="next"> |
| 56 | + <i class="fa fa-arrow-right"></i> |
| 57 | + </button> |
| 58 | + </div> |
| 59 | +</div> |
| 60 | + |
| 61 | + |
| 62 | +<div |
| 63 | + class="carousel-content-wrapper" |
| 64 | + [ngStyle]="{ |
| 65 | + 'height': carouselOptions.keepAspectRatio ? null : carouselOptions.carouselHeightPx + 'px', |
| 66 | + 'aspect-ratio': carouselOptions.keepAspectRatio ? carouselOptions.aspectRatio : null |
| 67 | + }" |
| 68 | + *ngIf="(isLoading$ | async)" |
| 69 | +> |
| 70 | + <a |
| 71 | + href="#" |
| 72 | + target="_blank" |
| 73 | + class="img-container-el"> |
| 74 | + <div class="picsum-img-wrapper flex-column"> |
| 75 | + <img class="img-fluid" src="assets/images/replacement_image.svg"> |
| 76 | + {{'loading.default' | translate}} |
| 77 | + </div> |
| 78 | + </a> |
41 | 79 | </div> |
0 commit comments