fix: no proper loading feedback on forms
This commit is contained in:
parent
cbb14ffba2
commit
d224f5a10a
27 changed files with 192 additions and 57 deletions
|
|
@ -164,4 +164,30 @@
|
|||
"rlig" 1,
|
||||
"calt" 1;
|
||||
}
|
||||
|
||||
/* HTMX submit button loading states */
|
||||
.htmx-submit-btn .btn-spinner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.htmx-request .htmx-submit-btn .btn-label,
|
||||
.htmx-request.htmx-submit-btn .btn-label {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.htmx-request .htmx-submit-btn .btn-spinner,
|
||||
.htmx-request.htmx-submit-btn .btn-spinner {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.htmx-request .htmx-submit-btn,
|
||||
.htmx-request.htmx-submit-btn {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
assets/js/form-submit.js
Normal file
8
assets/js/form-submit.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.addEventListener('submit', function(e) {
|
||||
var btn = e.target.querySelector('.htmx-submit-btn');
|
||||
if (btn) {
|
||||
e.target.classList.add('htmx-request');
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue