mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-08-07 15:28:45 +09:00
Hello world
First open source release of Campfire 🎉
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user