Skip to content

Commit

Permalink
Merged in feature/lightbox-default-image (pull request gothinkster#22)
Browse files Browse the repository at this point in the history
Feature/lightbox-default-image

* added default image to lightbox (when product doesn't have images)
  • Loading branch information
Jaques Candeias committed Mar 29, 2022
1 parent e73179e commit 079cc7c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/shared/lightbox/lightbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import { Lightbox } from 'ng-gallery/lightbox';
})
export class LightboxComponent implements OnInit {
items: GalleryItem[] = [];
@Input() imageData: { src: string, thumb: string}[] = [];
@Input() imageData: { src: string, thumb: string }[] = [];
@Input() thumbSize?: string;
@Input() classes: string = '';

constructor(public gallery: Gallery, public lightbox: Lightbox) {
}

ngOnInit(): void {
if (this.imageData.length === 0) {
const img = 'assets/default-placeholder.png';
this.imageData.push({ src: img, thumb: img });
}
this.items = this.imageData.map(item => new ImageItem({ src: item.src, thumb: item.thumb }));
const lightboxRef = this.gallery.ref('lightbox');
lightboxRef.load(this.items);
Expand Down

0 comments on commit 079cc7c

Please sign in to comment.