Small cleanup around images

This commit is contained in:
Joseph Milazzo 2021-01-07 12:50:11 -06:00
parent 2fa6b9a46a
commit b640b1276a
3 changed files with 11 additions and 5 deletions

View file

@ -1,6 +1,6 @@
<div class="card" style="width: 18rem;">
<div class="overlay">
<img (click)="handleClick()" class="card-img-top" [src]="isNullOrEmpty(imageUrl) ? placeholderImage : safeImage" alt="{{title}}">
<div class="overlay" (click)="handleClick()">
<img class="card-img-top" [src]="isNullOrEmpty(imageUrl) ? placeholderImage : safeImage" alt="{{title}}">
<div class="overlay-item card-actions">
<ng-container *ngIf="actions.length > 0">
<div ngbDropdown container="body" class="d-inline-block">

View file

@ -5,6 +5,7 @@ $primary-color: #cc7b19;
// max-width: 130px;
// max-height: 195px;
max-width: 160px;
cursor: pointer;
//max-height: 320px;
// 370 x 210 roughly

View file

@ -37,16 +37,21 @@ export class CardItemComponent implements OnInit {
return val === null || val === undefined || val === '';
}
performAction(event: any, action: CardItemAction) {
preventClick(event: any) {
event.stopPropagation();
event.preventDefault();
}
performAction(event: any, action: CardItemAction) {
this.preventClick(event);
if (typeof action.callback === 'function') {
action.callback(this.entity);
}
}
createSafeImage(coverImage: string) {
let imageUrl = 'data:image/jpeg;base64,' + coverImage;
this.safeImage = this.sanitizer.bypassSecurityTrustUrl(imageUrl);
this.safeImage = this.sanitizer.bypassSecurityTrustUrl('data:image/jpeg;base64,' + coverImage);
}
}