mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-12-19 20:12:52 +02:00
cheat-sheet: Show no icons by default
[why] The additional hints in the bottom are hard to notice if we flood users with all available items first. Usually users want to search the icons and not browse, so showing them all per default seems better. [how] Just do not change the search term from "" to something else, so the search comes up empty on an empty search. If people search for a blank the previous mechanics to show all icons is triggered instead. A message to hint for this is added to the empty search result. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
1df198249a
commit
fa0d3c7e98
@ -127,12 +127,17 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
function searchGlyphs() {
|
function searchGlyphs() {
|
||||||
let searchTerm = elementGlyphSearch.value;
|
let searchTerm = elementGlyphSearch.value;
|
||||||
|
|
||||||
let prefixSearchEnabled = true
|
let prefixSearchEnabled = true;
|
||||||
|
let emptyResultsMessage = `<span style="font-size: 30px;">No matches found</span>`;
|
||||||
|
|
||||||
if (searchTerm === "") {
|
if (searchTerm === "") {
|
||||||
// MiniSearch don't allow empty searches, so we search for "nf".
|
// MiniSearch doesn't allow empty searches and we want to show the bottom info
|
||||||
searchTerm = "nf";
|
emptyResultsMessage = "Enter (part) of a word to search for or enter space / blank (' ') to show all icons"
|
||||||
|
} else {
|
||||||
|
if (searchTerm === " ") {
|
||||||
prefixSearchEnabled = false;
|
prefixSearchEnabled = false;
|
||||||
|
searchTerm = "nf";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: search suggestions
|
// TODO: search suggestions
|
||||||
@ -157,7 +162,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
} else {
|
} else {
|
||||||
let notFoundElem = document.createElement("div");
|
let notFoundElem = document.createElement("div");
|
||||||
notFoundElem.setAttribute("style", "padding: 10px;");
|
notFoundElem.setAttribute("style", "padding: 10px;");
|
||||||
notFoundElem.innerHTML = `<span style="font-size: 30px;">No matches found</span>`;
|
notFoundElem.innerHTML = emptyResultsMessage;
|
||||||
elementGlyphCheatSheet.appendChild(notFoundElem);
|
elementGlyphCheatSheet.appendChild(notFoundElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user