Skip to content

Commit

Permalink
feat: no search entries found page (open-telemetry#5372)
Browse files Browse the repository at this point in the history
  • Loading branch information
JennySimen authored and chalin committed Dec 5, 2024
1 parent 30d2376 commit 3a21706
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Binary file added assets/icons/search-not-found.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions assets/js/registrySearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ function executeSearch(searchQuery) {
let results = miniSearch.search(searchQuery);
document.getElementById('search-loading').style.display = 'none';

if (results.length > 0) {
populateResults(results);
} else {
document.querySelector('#search-results').innerHTML +=
'<p>No matches found</p>';
}
if (results.length === 0) {
document.getElementById('no-search-result').style.display = 'block';
}

populateResults(results);

}, 0);
};

Expand Down
14 changes: 14 additions & 0 deletions layouts/shortcodes/ecosystem/registry/search-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,20 @@
<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
<span role="status">Loading results…</span>
</div>

<!-- When search hs no result -->
<div style="display: none; padding:20px; text-align: center;" id="no-search-result">
<div style="margin-left: auto; margin-right: auto; width: fit-content;">
{{ with resources.Get "icons/search-not-found.png" }}
<img style="border: none;" src="{{ .RelPermalink }}" width="250" alt="no result found">
{{ end }}
</div>
<p style="color: #4f62ad; font-size: 28px; margin-bottom: 0;">Oops no results found</p>
<p>No results match the filter criteria. Remove filter or clear all filters to show results</p>
<button type="button" class="btn btn-outline-danger"
onclick="document.getElementById('input-s').value = ''; document.getElementById('input-language').value = 'all';document.getElementById('input-component').value = 'all';document.getElementById('searchForm').submit();">Reset filters</button>
</div>

<ul class="list-unstyled" id="search-results"></ul>
<ul class="list-unstyled" id="default-body">
{{ range $key, $value := $registry -}}
Expand Down

0 comments on commit 3a21706

Please sign in to comment.