Skip to content

Commit

Permalink
refactor: use links instead of buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
deansallinen committed Oct 4, 2024
1 parent 24f3150 commit c14c4d2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/lib/components/input/search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,21 @@
}
function goToResult() {
$open = false;
if (result) {
goto(result);
addHistory({ result, searchType });
}
closeSearch();
}
function closeSearch() {
$open = false;
searchValue = '';
}
function goToHistory(url: string) {
goto(url);
$open = false;
searchValue = '';
closeSearch();
}
if (debug) {
Expand Down Expand Up @@ -222,14 +225,15 @@
</div>

{#each history as item, index}
<button
<a
class="table-row-styles col-span-full grid grid-cols-subgrid justify-items-start"
onclick={() => goToHistory(item.result)}
href={item.result}
onclick={closeSearch}
data-active={index === selectedIndex}
>
<span class="table-cell-styles">{item.searchType}</span>
<span class="table-cell-styles truncate">{item.result}</span>
</button>
</a>
{/each}
</div>
</div>
Expand Down

0 comments on commit c14c4d2

Please sign in to comment.