responsive design
This commit is contained in:
1 parent
9217960de0
commit
0ae5f49bcf
23 files changed
+380
-157
No files matched your search
@@ -11,10 +11,19 @@ import { Controller } from '@hotwired/stimulus'
|
||||
// `change` covers native inputs (checkbox, select); the range slider emits its
|
||||
// own `range-slider:change` on commit. Uses requestSubmit() (not submit()) so a
|
||||
// <turbo-frame> around the form still captures the navigation and validation runs.
|
||||
//
|
||||
// Optional data-auto-submit-media-value="(min-width: 64rem)" limits auto-submit
|
||||
// to viewports matching that query — below it the form waits for its own submit
|
||||
// button (e.g. the mobile filters drawer's "Apply").
|
||||
export default class extends Controller {
|
||||
static values = { delay: { type: Number, default: 300 } }
|
||||
static values = {
|
||||
delay: { type: Number, default: 300 },
|
||||
media: String,
|
||||
}
|
||||
|
||||
submit() {
|
||||
if (this.mediaValue && !window.matchMedia(this.mediaValue).matches) return
|
||||
|
||||
clearTimeout(this.#timer)
|
||||
this.#timer = setTimeout(() => this.element.requestSubmit(), this.delayValue)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user