Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: no search entries found page (#5372) #5462

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/icons/search-not-found.png
svrnm marked this conversation as resolved.
Show resolved Hide resolved
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