feat: add addBrand prop to CardSmall, CardMiddle, List, and Home components for brand filtering

This commit is contained in:
sHa
2025-05-29 17:40:35 +03:00
parent f1731e55dd
commit 585589a2d4
4 changed files with 9 additions and 15 deletions

View File

@@ -8,8 +8,8 @@
export let theme;
export let onCopy;
export let onDownload;
export let setSearchQuery;
export let allLogos = [];
export let addBrand = () => {};
export const setTheme = () => {};
function openPreview(logo) {
@@ -63,13 +63,8 @@
class="brand-filter-btn"
title="Filter by brand"
on:click={() => {
console.log('CardSquare: Filtering by brand:', logo.brand);
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);
console.log('CardMiddle: Filtering by brand:', logo.brand);
addBrand(logo.brand);
}}
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">

View File

@@ -8,8 +8,8 @@
export let theme;
export let onCopy;
export let onDownload;
export let setSearchQuery;
export let allLogos = [];
export let addBrand = () => {};
export const setTheme = () => {};
function openPreview(logo) {
@@ -64,12 +64,7 @@
title="Filter by brand"
on:click={() => {
console.log('CardList: Filtering by brand:', logo.brand);
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);
addBrand(logo.brand);
}}
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">

View File

@@ -9,6 +9,7 @@
export let onDownload;
export let setSearchQuery;
export let allLogos = [];
export let addBrand = () => {};
export let theme;
export let viewMode = "grid";
export let setTheme = () => {};
@@ -26,6 +27,7 @@
{onDownload}
{setSearchQuery}
{allLogos}
{addBrand}
{setTheme}
/>
{:else if viewMode === "compact"}
@@ -44,6 +46,7 @@
{onDownload}
{setSearchQuery}
{allLogos}
{addBrand}
{setTheme}
/>
{/if}

View File

@@ -220,6 +220,7 @@
{onDownload}
{setSearchQuery}
{allLogos}
{addBrand}
{setTheme}
/>
</main>