diff --git a/src/layouts/partials/no-results-found.html b/src/layouts/partials/no-results-found.html index 628e831..f27ee3d 100644 --- a/src/layouts/partials/no-results-found.html +++ b/src/layouts/partials/no-results-found.html @@ -1,5 +1,5 @@
-
+
@@ -10,3 +10,12 @@

+ + \ No newline at end of file diff --git a/src/layouts/partials/package-grid.html b/src/layouts/partials/package-grid.html index 913f6ff..40545eb 100644 --- a/src/layouts/partials/package-grid.html +++ b/src/layouts/partials/package-grid.html @@ -24,6 +24,7 @@ {{- partial "package-thumbnail.html" .}} {{ end }} + {{- partial "no-results-found.html" }}
@@ -120,6 +121,7 @@ const onSearch = debounce(() => { const searchInput = document.getElementById('searchTermDesktop'); + const noResult = document.getElementById('noResult'); if (searchInput.value) { const term = searchInput.value; const packages = getPackageThumbs(); @@ -130,16 +132,25 @@ }); const grid = document.getElementById('packageGrid'); grid.textContent = ''; + let searchCount = 0; for(const sp of sortedPackages) { const score = getMatchScore(term, sp.dataset); if (score > 20) { sp.classList.remove('hidden'); + searchCount++; } else { sp.classList.add('hidden'); } grid.appendChild(sp); } + + if (searchCount) { + noResult.classList.remove('show'); + } else { + noResult.classList.add('show'); + } } else { + noResult.classList.remove('show'); sortPackages(); } }, 300);