add animation while uploading a dropped file

This commit is contained in:
Niko Abeler 2024-05-09 10:58:32 +02:00
parent ff10f6c5eb
commit 4bdb920c71
2 changed files with 28 additions and 1 deletions

View File

@ -30,6 +30,7 @@ function addFileDrop(id) {
const formData = new FormData()
formData.append("file", file)
textArea.classList.add("drop-file-process")
fetch(
"/admin/api/binaries",
{
@ -44,6 +45,11 @@ function addFileDrop(id) {
} else {
textArea.value += `\n[${file.name}](${data.location})`
}
textArea.classList.remove("drop-file-process")
}).catch(err => {
console.error(err);
}).finally(() => {
textArea.classList.remove("drop-file-process")
})
}

View File

@ -28,4 +28,25 @@
border-style: dashed;
border-width: 4px;
border-color: #5391ff;
}
}
@keyframes border-pulsate {
0% {
border-color: #5391ff;
}
50% {
border-color: rgba(0, 255, 255, 0);
}
100% {
border-color: #5391ff;
}
}
.drop-file-process {
border-style: dashed;
border-width: 4px;
border-color: #5391ff;
animation: border-pulsate 2s infinite;
}