Skip to content

Commit 159956a

Browse files
committed
Sort options in ShowMore alphabetically
1 parent 7627751 commit 159956a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib/components/Facets/ShowMore.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
export let handleApply: (group: SelectedFacetGroup) => {};
66
export let handleCancel: (groupName: string) => {};
77
8-
let selected = structuredClone(group.children);
8+
let selected = Object.keys(group.children)
9+
.sort((a, b) => group.children[a].displayName.localeCompare(group.children[b].displayName))
10+
.map((key) => ({ [key]: { ...group.children[key] } }))
11+
.reduce((acc, val) => ({ ...acc, ...val }), {});
912
1013
const selectAll = () => {
1114
Object.keys(selected).forEach((key) => (selected[key].selected = true));
@@ -37,7 +40,7 @@
3740
<h2 class="text-xl font-semibold">{group.displayName}</h2>
3841

3942
<!-- Items -->
40-
<div class="gap-x-10 gap-y-3 py-10 px-2 max-h-[500px] columns-[192px] overflow-auto">
43+
<div class="gap-x-10 space-y-2 py-6 px-[2px] max-h-[500px] columns-[192px] overflow-auto min-h">
4144
{#each Object.keys(selected) as key}
4245
<label class="flex gap-3 items-center w-48">
4346
<input type="checkbox" class="checkbox" bind:checked={selected[key].selected} />

0 commit comments

Comments
 (0)