Added a "No results found"

This commit is contained in:
Beverly Nguyen
2025-05-28 11:59:54 -07:00
parent e950e87ded
commit f5690c3384
2 changed files with 10 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
let query = normalize($searchBox.val());
let results = 0;
let $noResultsMessage = $('.js-live-search-no-results');
$targets.each(function() {
@@ -39,6 +40,12 @@
});
if (query !== '' && results === 0) {
$noResultsMessage.show();
} else {
$noResultsMessage.hide();
}
if (state === 'loaded') {
if (query !== '') {
$searchBox.attr('aria-label', $searchLabel.text().trim() + ', ' + resultsSummary(results));

View File

@@ -36,6 +36,9 @@
{% endif %}
<div class="user-list">
<div class="js-live-search-no-results margin-top-3" style="display: none;">
<p class="usa-body margin-0">No results found</p>
</div>
{% for user in users %}
{% if user.status != 'cancelled' %}
<div class="user-list-item width-full">