Skip to content

Commit

Permalink
Move exact search matches to top of dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
smilingkylan committed Dec 5, 2023
1 parent dd13a8b commit 45a22d8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/HeaderSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ export default defineComponent({
} as TableByScope]);
}
let label = 'Accounts';
if (accounts.length > 0) {
results.push({
label: 'Accounts',
label: label,
to: '',
isHeader: true,
});
Expand All @@ -73,6 +74,18 @@ export default defineComponent({
});
}
});
type Result = { label: string, to: string, isHeader: boolean }
results.sort((a: Result, b: Result) => {
if (a.label === label) {
return -1;
}
if (a.label === value) {
if (b.label === label) {
return 1;
}
return -1;
}
});
}
return results;
} catch (error) {
Expand Down

0 comments on commit 45a22d8

Please sign in to comment.