Add simple color loop when loading query.

This commit is contained in:
Sergio Martínez Portela 2023-05-01 22:37:00 +02:00
parent bdda2f3676
commit 210a508a90
2 changed files with 25 additions and 0 deletions

View File

@ -67,6 +67,7 @@ function _codigoparallevar_enable_search_box(selector, options) {
return;
}
lastVal = val;
resultsBox.classList.add('loading');
const uri = SEARCH_ENDPOINT + '?q=' + encodeURIComponent(val);
let query = fetch(uri);
@ -79,6 +80,7 @@ function _codigoparallevar_enable_search_box(selector, options) {
return;
}
resultsBox.classList.remove('loading');
resultsList.innerHTML = '';
for (const list of [
body.results.notes.filter(n => n.is_todo !== "1"),

View File

@ -84,6 +84,29 @@ body nav input {
border-bottom: 1px solid #000;
}
@keyframes loading-query {
from {
border-bottom-color: hsl(0 80% 40%);
}
30% {
border-bottom-color: hsl(80 80% 40%);
}
60% {
border-bottom-color: hsl(180 80% 40%);
}
to {
border-bottom-color: hsl(360 80% 40%);
}
}
.results-box-container .results-box.loading input {
animation-name: loading-query;
border-bottom-width: 2px;
animation-duration: 2s;
margin-bottom: -1px;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
/* Search box results */
.results-box ul {
list-style: none;