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 committed Oct 23, 2024
1 parent 4a8e68b commit 667a979
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 @@ -137,12 +137,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 @@ -97,6 +97,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 667a979

Please sign in to comment.