mirror of
https://github.com/shadoll/sLogos.git
synced 2026-02-04 02:53:22 +00:00
Add search parameter update to brand filter buttons in Grid and List components
This commit is contained in:
@@ -72,7 +72,14 @@ $: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
|
|||||||
<div class="logo-info">
|
<div class="logo-info">
|
||||||
<div class="logo-title-row">
|
<div class="logo-title-row">
|
||||||
<h3>{logo.name}</h3>
|
<h3>{logo.name}</h3>
|
||||||
<button class="brand-filter-btn" title="Filter by brand" on:click={() => setSearchQuery(logo.brand)}>
|
<button class="brand-filter-btn" title="Filter by 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"/></svg>
|
<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"/></svg>
|
||||||
{#if allLogos && allLogos.filter(l => l.brand === logo.brand).length > 1}
|
{#if allLogos && allLogos.filter(l => l.brand === logo.brand).length > 1}
|
||||||
<span class="brand-count">{allLogos.filter(l => l.brand === logo.brand).length}</span>
|
<span class="brand-count">{allLogos.filter(l => l.brand === logo.brand).length}</span>
|
||||||
|
|||||||
@@ -163,7 +163,14 @@
|
|||||||
<button
|
<button
|
||||||
class="brand-filter-btn common-btn"
|
class="brand-filter-btn common-btn"
|
||||||
title="Filter by brand"
|
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">
|
<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"/>
|
<path stroke="currentColor" stroke-linejoin="round" stroke-width="2" d="M20 4H4v2l6 6v8.5l4-2.5v-6l6-6V4z"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user