Add search parameter update to brand filter buttons in Grid and List components

This commit is contained in:
sha
2025-05-04 13:55:53 +03:00
parent a007d67828
commit 7b6fbbf280
2 changed files with 16 additions and 2 deletions
+8 -1
View File
@@ -163,7 +163,14 @@
<button
class="brand-filter-btn common-btn"
title="Filter by brand"
on:click={() => setSearchQuery(logo.brand)}
on:click={() => {
setSearchQuery(logo.brand);
// Update URL with search param
const params = new URLSearchParams(window.location.search);
params.set('search', logo.brand);
const newUrl = window.location.pathname + (params.toString() ? '?' + params.toString() : '');
history.replaceState(null, '', newUrl);
}}
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M20 4H4v2l6 6v8.5l4-2.5v-6l6-6V4z"/>