This is too fancy, remove it
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
import { orient } from "helpers/orientation_helpers"
|
||||
import { limitHeightToViewport } from "helpers/sizing_helpers"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "dialog" ]
|
||||
@@ -23,8 +22,6 @@ export default class extends Controller {
|
||||
orient(this.dialogTarget)
|
||||
}
|
||||
|
||||
limitHeightToViewport(this.dialogTarget, this.sizingValue)
|
||||
|
||||
this.loadLazyFrames()
|
||||
this.dialogTarget.setAttribute("aria-hidden", "false")
|
||||
this.dispatch("show")
|
||||
@@ -43,7 +40,6 @@ export default class extends Controller {
|
||||
this.dialogTarget.setAttribute("aria-hidden", "true")
|
||||
this.dialogTarget.blur()
|
||||
orient(this.dialogTarget, false)
|
||||
limitHeightToViewport(this.dialogTarget, false)
|
||||
this.dispatch("close")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
export function limitHeightToViewport(el, sizing = true, margin = 64) {
|
||||
if (!el) return
|
||||
|
||||
if (sizing) {
|
||||
const rect = el.getBoundingClientRect()
|
||||
const top = Math.max(rect.top, margin)
|
||||
const max = Math.max(0, window.innerHeight - margin - top)
|
||||
el.style.maxHeight = `${max}px`
|
||||
} else {
|
||||
el.style.maxHeight = ""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user