Skip to content

Commit 61b3c6b

Browse files
committed
fix: switch to ternary expressions for search
1 parent 52a5562 commit 61b3c6b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/lib/components/mods/ModGrid.svelte

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,12 @@
4545
let totalMods: number;
4646
4747
let searchField = search;
48-
let searchDisabled = true;
49-
let searchButtonClass = 'variant-filled-primary';
50-
const showPagination: boolean = $mods && !$mods.error && !$mods.fetching;
48+
$: showPagination = $mods && !$mods.error && !$mods.fetching;
49+
$: searchDisabled = searchField.length > 2;
50+
$: searchButtonClass = searchDisabled ? 'variant-filled-primary' : 'variant-filled-surface';
5151
5252
let timer: number;
5353
$: {
54-
if (searchField.length > 2) {
55-
searchDisabled = false;
56-
searchButtonClass = 'variant-filled-primary';
57-
} else {
58-
searchDisabled = true;
59-
searchButtonClass = 'variant-filled-surface';
60-
}
6154
clearTimeout(timer);
6255
timer = setTimeout(() => {
6356
if (searchField && searchField.length > 2) {

0 commit comments

Comments
 (0)