mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-02-21 20:20:34 +09:00
25 lines
649 B
JavaScript
25 lines
649 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
export default class extends Controller {
|
|
static targets = [ "image", "dialog", "zoomedImage", "download", "share" ]
|
|
|
|
open(event) {
|
|
event.preventDefault()
|
|
|
|
this.dialogTarget.showModal()
|
|
this.#set(event.target.closest("a"))
|
|
}
|
|
|
|
reset() {
|
|
this.zoomedImageTarget.src = ""
|
|
this.downloadTarget.href = ""
|
|
this.shareTarget.dataset.webShareFilesValue = "";
|
|
}
|
|
|
|
#set(target) {
|
|
this.zoomedImageTarget.src = target.href
|
|
this.downloadTarget.href = target.dataset.lightboxUrlValue;
|
|
this.shareTarget.dataset.webShareFilesValue = target.dataset.lightboxUrlValue;
|
|
}
|
|
}
|