Files
sLogos/src/components/List.svelte
T
sha 5d1bae8008 Refactor Home and Preview pages for improved data handling and UI components
- Updated Home.svelte to streamline app data initialization and reactivity.
- Removed unnecessary intervals and checks for app data updates.
- Enhanced data binding for logos, view modes, and themes.
- Simplified the structure of the Header and Footer components.
- Introduced CardList and CardSquare components for better logo display.
- Improved routing with a NotFound page for unmatched routes.
- Added a RouteHeader component for search functionality and theme switching.
- Enhanced styling for better user experience across components.
2025-05-16 02:24:04 +03:00

70 lines
1.5 KiB
Svelte

<script>
import CardList from './CardList.svelte';
import CardSquare from './CardSquare.svelte';
import { getDefaultLogoColor } from '../utils/colorTheme.js';
export let logos = [];
export let onCopy;
export let onDownload;
export let setSearchQuery;
export let allLogos = [];
export let theme;
export let viewMode = "grid"; // "grid" or "list"
export let setTheme = () => {}; // Add setTheme prop with default no-op function
$: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
</script>
<div class={`logos-container ${viewMode}-view`}>
{#each logos as logo}
{#if viewMode === "grid"}
<CardSquare
{logo}
{theme}
{onCopy}
{onDownload}
{setSearchQuery}
{allLogos}
{setTheme}
/>
{:else}
<CardList
{logo}
{theme}
{onCopy}
{onDownload}
{setSearchQuery}
{allLogos}
{setTheme}
/>
{/if}
{:else}
<p class="no-results">No logos found matching your search criteria.</p>
{/each}
</div>
<style>
.logos-container {
width: 100%;
}
.grid-view {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
gap: 1.5rem;
}
.list-view {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
gap: 0.75rem;
}
.no-results {
text-align: center;
padding: 2rem;
color: #666;
grid-column: 1 / -1; /* For grid view */
}
</style>