mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
dropdown_widget: Show "No search results" instead of an empty list.
This commit is contained in:
@@ -58,6 +58,16 @@ export function setup(tippy_props, get_options, item_click_callback, dropdown_pr
|
|||||||
$simplebar_container: $popper.find(".dropdown-list-wrapper"),
|
$simplebar_container: $popper.find(".dropdown-list-wrapper"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$search_input.on("input.list_widget_filter", () => {
|
||||||
|
const list_items = list_widget.get_current_list();
|
||||||
|
const $no_search_results = $popper.find(".no-dropdown-items");
|
||||||
|
if (list_items.length === 0) {
|
||||||
|
$no_search_results.show();
|
||||||
|
} else {
|
||||||
|
$no_search_results.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Keyboard handler
|
// Keyboard handler
|
||||||
$popper.on("keydown", (e) => {
|
$popper.on("keydown", (e) => {
|
||||||
function trigger_element_focus($element) {
|
function trigger_element_focus($element) {
|
||||||
|
|||||||
@@ -3077,6 +3077,13 @@ select.invite-as {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dropdown-list-item-common-styles {
|
||||||
|
padding: 3px 10px 3px 8px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 20px;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-list-wrapper {
|
.dropdown-list-wrapper {
|
||||||
/* Sync with `max-height` in dropdown_widget. */
|
/* Sync with `max-height` in dropdown_widget. */
|
||||||
max-height: 210px;
|
max-height: 210px;
|
||||||
@@ -3093,12 +3100,7 @@ select.invite-as {
|
|||||||
|
|
||||||
.list-item a {
|
.list-item a {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 3px 10px 3px 8px;
|
|
||||||
clear: both;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 20px;
|
|
||||||
color: hsl(0deg 0% 20%);
|
color: hsl(0deg 0% 20%);
|
||||||
white-space: normal;
|
|
||||||
|
|
||||||
.stream-privacy-type-icon {
|
.stream-privacy-type-icon {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -3119,4 +3121,9 @@ select.invite-as {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-dropdown-items {
|
||||||
|
color: hsl(0deg 0% 60%);
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{{#with item}}
|
{{#with item}}
|
||||||
<li class="list-item" role="presentation" data-unique-id="{{unique_id}}" data-name="{{name}}" tabindex="0">
|
<li class="list-item" role="presentation" data-unique-id="{{unique_id}}" data-name="{{name}}" tabindex="0">
|
||||||
<a role="menuitem">
|
<a class="dropdown-list-item-common-styles" role="menuitem">
|
||||||
{{#if stream}}
|
{{#if stream}}
|
||||||
{{> inline_decorated_stream_name stream=stream show_colored_icon=true}}
|
{{> inline_decorated_stream_name stream=stream show_colored_icon=true}}
|
||||||
{{else if is_direct_message}}
|
{{else if is_direct_message}}
|
||||||
|
|||||||
@@ -5,4 +5,7 @@
|
|||||||
<div class="dropdown-list-wrapper" data-simplebar>
|
<div class="dropdown-list-wrapper" data-simplebar>
|
||||||
<ul class="dropdown-list"></ul>
|
<ul class="dropdown-list"></ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="no-dropdown-items dropdown-list-item-common-styles">
|
||||||
|
{{t 'No search results'}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user