import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { action } from '@ember/object'; import { on } from '@ember/modifier'; import Icon from './icon'; import PhotoCarousel from './photo-carousel'; export default class PhotoGallery extends Component { @tracked currentPhoto = this.args.selectedPhoto || this.args.photos?.[0]; @action handleClose() { if (this.args.onClose) { this.args.onClose(); } } @action handleBackgroundClick(e) { // Don't close if clicking on thumbnails, nav buttons, or the close button itself if ( e.target.closest('.thumbnail-strip-container') || e.target.closest('.carousel-nav-btn') || e.target.closest('.close-btn') ) { return; } this.handleClose(); } @action selectPhoto(photo) { this.currentPhoto = photo; } @action handleVisiblePhotoChange(photo) { if (this.currentPhoto !== photo) { this.currentPhoto = photo; } } }