diff --git a/src/lib/components/mosaic/RefCategory.svelte b/src/lib/components/mosaic/RefCategory.svelte index db3bee64..86f05a36 100644 --- a/src/lib/components/mosaic/RefCategory.svelte +++ b/src/lib/components/mosaic/RefCategory.svelte @@ -11,7 +11,7 @@
-

{item.category}

+

{item.category}

\ No newline at end of file diff --git a/src/routes/(content)/reference/+page.svx b/src/routes/(content)/reference/+page.svx index 02e174ea..480d6a74 100644 --- a/src/routes/(content)/reference/+page.svx +++ b/src/routes/(content)/reference/+page.svx @@ -21,28 +21,30 @@ layout: contentindex }; let query = ''; - references.forEach(r => { categorised[r.category].push(r) }); const search = new FuzzySearch(references, ['title', 'tags', 'blurb', 'category'], { caseSensitive: false, - sort: true + sort: false }) - function doSearch() { + function populateItems() { + return Object.entries(categorised).map(k => ({ "category" : k[0], "refs" : k[1] })); + } + let items = populateItems(); + function doSearch() { Object.keys(categorised).forEach(c => { categorised[c] = []; }); - - const searchResult = search.search(query); - searchResult.forEach(r => { + let result = query === '' ? references : search.search(query); + result.forEach(r => { categorised[r.category].push(r); }); - } - $: items = Object.entries(categorised).map(k => ({ "category" : k[0], "refs" : k[1] })); + items = populateItems(); + }

Reference

@@ -50,8 +52,8 @@ layout: contentindex
@@ -60,7 +62,7 @@ layout: contentindex