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) {
|
onSearchTermChange(term) {
|
||||||
this.debouncedSearch(term);
|
this.debouncedSearch(term);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
clearSearch() {
|
||||||
|
this.set("searchTerm", "");
|
||||||
|
this.onSearch("");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,5 +8,10 @@
|
||||||
placeholder=(i18n "knowledge_explorer.search.placeholder")
|
placeholder=(i18n "knowledge_explorer.search.placeholder")
|
||||||
autocapitalize="off"
|
autocapitalize="off"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
{{#if searchTerm}}
|
||||||
|
{{d-button action=(action "clearSearch") class="clear-search" label="knowledge_explorer.search.clear"}}
|
||||||
|
{{else}}
|
||||||
{{d-icon "search"}}
|
{{d-icon "search"}}
|
||||||
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -13,6 +13,15 @@
|
||||||
display: none;
|
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 {
|
.knowledge-explorer-search {
|
||||||
|
|
|
@ -13,6 +13,7 @@ en:
|
||||||
one: "%{count} result found"
|
one: "%{count} result found"
|
||||||
other: "%{count} results found"
|
other: "%{count} results found"
|
||||||
placeholder: "Search for topics"
|
placeholder: "Search for topics"
|
||||||
|
clear: "Clear"
|
||||||
topic:
|
topic:
|
||||||
back: "Go back"
|
back: "Go back"
|
||||||
navigate_to_topic: "View the discussion on this topic"
|
navigate_to_topic: "View the discussion on this topic"
|
||||||
|
|
Loading…
Reference in New Issue