Sha256: 74cb5f26783a2de735450b04af238dab6df387d24cbc90e72b851f7663ae28d0
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
import UIDialog from "controllers/ui/dialog_controller"; import "@kanety/stimulus-static-actions"; export default class extends UIDialog { // Handles a button triggering the sheet in a different // controller instance // REFACTOR: This is the toggle method in dialog_controller with dom elements // instead of targets. Update the method there to receive dom elements and this // can be refactored to use those methods instead of reimplementing. toggleOutlet() { const sheetTarget = document.querySelector(this.element.dataset.UiSheetOutlet); const dialogTarget = sheetTarget.querySelector("[data-ui--sheet-target='dialog']"); const modalTarget = sheetTarget.querySelector("[data-ui--sheet-target='modal']"); const contentTarget = sheetTarget.querySelector("[data-ui--sheet-target='content']"); const visible = dialogTarget.dataset.state == "closed" ? false : true; const mainTarget = document.body; if (!visible) { document.body.classList.add("overflow-hidden"); contentTarget.classList.add("overflow-y-scroll", "h-full"); dialogTarget.classList.remove("hidden"); dialogTarget.dataset.state = "open"; modalTarget.classList.remove("hidden"); modalTarget.dataset.state = "open"; } else { document.body.classList.remove("overflow-hidden"); contentTarget.classList.remove("overflow-y-scroll", "h-full"); dialogTarget.classList.add("hidden"); dialogTarget.dataset.state = "closed"; modalTarget.classList.add("hidden"); modalTarget.dataset.state = "closed"; } } }
Version data entries
3 entries across 3 versions & 1 rubygems