fix: improve search results

This commit is contained in:
afn 2022-11-26 18:51:52 -05:00
parent d4279a8038
commit df59e12780
2 changed files with 6 additions and 2 deletions

View File

@ -35,9 +35,9 @@ body {
:root {
--white: #fff;
--accent-low-opacity: #9ed7ff50;
--accent-color: #9fd5ff;
--accent-color-two: hsl(207, 65%, 90%);
--accent-low-opacity: #9ed7ff50;
--bg-color: hsl(240, 2%, 11%);
--grey-one: #252b31;
--grey-two: #28313b;

View File

@ -15,9 +15,13 @@
let current: boolean = false;
let searchTerm: string;
$: searchTermLowerCase = searchTerm?.toLowerCase();
function search(patch: Patch) {
if (patch.name.includes(searchTerm) || patch.description.includes(searchTerm)) {
if (
patch.description.toLowerCase().includes(searchTermLowerCase) ||
patch.name.replace(/-/g, ' ').toLowerCase().includes(searchTermLowerCase)
) {
return true;
}
return false;