FEATURE: Add clear button to search bar
Previously you had to clear the search results out by deleting them. This introduces a friendlier way to clear the search UX, especially if you didn't find what you're looking for.
This commit is contained in:
parent
abb9047d29
commit
e3be3fbb77
|
@ -11,5 +11,10 @@ export default Ember.Component.extend({
|
|||
onSearchTermChange(term) {
|
||||
this.debouncedSearch(term);
|
||||
},
|
||||
|
||||
clearSearch() {
|
||||
this.set("searchTerm", "");
|
||||
this.onSearch("");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -8,5 +8,10 @@
|
|||
placeholder=(i18n "knowledge_explorer.search.placeholder")
|
||||
autocapitalize="off"
|
||||
}}
|
||||
{{d-icon "search"}}
|
||||
|
||||
{{#if searchTerm}}
|
||||
{{d-button action=(action "clearSearch") class="clear-search" label="knowledge_explorer.search.clear"}}
|
||||
{{else}}
|
||||
{{d-icon "search"}}
|
||||
{{/if}}
|
||||
</span>
|
||||
|
|
|
@ -13,6 +13,15 @@
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
.btn.clear-search {
|
||||
background-color: var(--secondary);
|
||||
color: var(--tertiary);
|
||||
font-size: .75em;
|
||||
position: absolute;
|
||||
right: 0.80em;
|
||||
text-transform: lowercase;
|
||||
top: 20%;
|
||||
}
|
||||
}
|
||||
|
||||
.knowledge-explorer-search {
|
||||
|
|
|
@ -13,6 +13,7 @@ en:
|
|||
one: "%{count} result found"
|
||||
other: "%{count} results found"
|
||||
placeholder: "Search for topics"
|
||||
clear: "Clear"
|
||||
topic:
|
||||
back: "Go back"
|
||||
navigate_to_topic: "View the discussion on this topic"
|
||||
|
|
Loading…
Reference in New Issue