Add new logos and refactor header component

This commit is contained in:
sHa
2025-05-01 01:51:14 +03:00
parent aaf7db1471
commit a49568a389
11 changed files with 432 additions and 540 deletions

View File

@@ -359,7 +359,7 @@
right: 0;
min-width: 160px;
background: var(--color-card, #fff);
color: var(--color-text, #222);
color: var(--text-color, #222);
border: 1px solid var(--color-border, #ddd);
border-radius: 8px;
box-shadow: 0 2px 16px 4px rgba(0,0,0,0.18);

View File

@@ -0,0 +1,84 @@
<script>
export let logos = [];
export let theme;
export let setTheme;
export let viewMode;
export let setGridView;
export let setListView;
export let searchQuery;
export let allTags = [];
export let selectedTags = [];
export let tagDropdownOpen;
export let toggleDropdown;
export let addTag;
export let removeTag;
export let getTagObj;
</script>
<header class="main-header">
<div class="header-row">
<h1>Logo Gallery</h1>
<span class="logo-count">{logos.length} images in gallery</span>
<div class="theme-switcher">
<div class="theme-switch-group">
<button on:click={() => setTheme('system')} class:active={theme === 'system'} aria-label="System theme">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="8" stroke="currentColor" stroke-width="2"/><path d="M10 2a8 8 0 0 1 8 8" stroke="currentColor" stroke-width="2"/></svg>
</button>
<button on:click={() => setTheme('light')} class:active={theme === 'light'} aria-label="Light mode">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="5" stroke="currentColor" stroke-width="2"/><path d="M10 1v2M10 17v2M3.22 3.22l1.42 1.42M15.36 15.36l1.42 1.42M1 10h2M17 10h2M3.22 16.78l1.42-1.42M15.36 4.64l1.42-1.42" stroke="currentColor" stroke-width="2"/></svg>
</button>
<button on:click={() => setTheme('dark')} class:active={theme === 'dark'} aria-label="Dark mode">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.5 13A7 7 0 0 1 7 4.5a7 7 0 1 0 8.5 8.5z" stroke="currentColor" stroke-width="2"/></svg>
</button>
</div>
</div>
</div>
<div class="header-row header-controls">
<div class="search-bar">
<input type="text" placeholder="Search logos..." bind:value={searchQuery} />
</div>
<div class="tag-filter">
{#each selectedTags as tagText}
{#if getTagObj(tagText)}
<button
class="selected-tag"
style={getTagObj(tagText).color ? `background: ${getTagObj(tagText).color}; color: #fff;` : ''}
aria-label={`Remove tag: ${getTagObj(tagText).text}`}
on:click={() => removeTag(getTagObj(tagText).text)}
>
{getTagObj(tagText).text}
<span class="close">&times;</span>
</button>
{/if}
{/each}
<div class="tag-dropdown">
<button class="dropdown-toggle" on:click={toggleDropdown} aria-label="Add tag filter">
+ Tag{selectedTags.length ? '' : 's'}
</button>
{#if tagDropdownOpen}
<div class="dropdown-list">
{#each allTags.filter(t => !selectedTags.includes(t.text)) as tagObj}
<button
class="dropdown-tag"
style={tagObj.color ? `background: ${tagObj.color}; color: #fff;` : ''}
on:click={() => addTag(tagObj.text)}
aria-label={`Add tag: ${tagObj.text}`}
>{tagObj.text}</button>
{/each}
{#if allTags.filter(t => !selectedTags.includes(t.text)).length === 0}
<span class="no-tags">No more tags</span>
{/if}
</div>
{/if}
</div>
</div>
<div class="view-toggle">
<button class:active={viewMode === 'grid'} on:click={setGridView} aria-label="Grid view">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="6" height="6" fill="currentColor"/><rect x="11" y="3" width="6" height="6" fill="currentColor"/><rect x="3" y="11" width="6" height="6" fill="currentColor"/><rect x="11" y="11" width="6" height="6" fill="currentColor"/></svg>
</button>
<button class:active={viewMode === 'list'} on:click={setListView} aria-label="List view">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="4" y="5" width="12" height="2" fill="currentColor"/><rect x="4" y="9" width="12" height="2" fill="currentColor"/><rect x="4" y="13" width="12" height="2" fill="currentColor"/></svg>
</button>
</div>
</div>
</header>

View File

@@ -159,7 +159,7 @@ $: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
:global(.modal-content) {
background: var(--color-card);
color: var(--color-text);
color: var(--text-color);
border-radius: 8px;
padding: 1rem;
max-width: 500px;
@@ -186,7 +186,7 @@ $: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
border: none;
font-size: 1.5rem;
cursor: pointer;
color: var(--color-text, #222);
color: var(--text-color, #222);
transition: color 0.2s;
}
@@ -222,7 +222,7 @@ $: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
.logo-details {
padding: 1rem;
background-color: var(--color-card);
color: var(--color-text);
color: var(--text-color);
border-radius: 4px;
transition: background 0.2s, color 0.2s;
}

View File

@@ -1,7 +1,5 @@
<script>
export let logo;
export let onCopy;
export let onDownload;
export let view = 'grid'; // or 'list'
export let showActions = true;
export let onPreview = null;
@@ -69,99 +67,3 @@
</div>
{/if}
</div>
<style>
.logo-row {
display: flex;
align-items: center;
padding: 0.5em 0.5em;
border-bottom: 1px solid #eee;
gap: 1em;
}
.logo-row.grid {
flex-direction: column;
align-items: stretch;
border-bottom: none;
border-radius: 10px;
box-shadow: 0 1px 4px rgba(0,0,0,0.04);
margin-bottom: 1em;
padding: 1em;
}
.logo-row.list {
flex-direction: row;
align-items: center;
border-radius: 0;
box-shadow: none;
margin-bottom: 0;
padding: 0.5em 0.5em;
}
.logo-img {
flex-shrink: 0;
width: 64px;
height: 64px;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 8px;
box-shadow: 0 1px 2px rgba(0,0,0,0.04);
cursor: pointer;
}
.logo-info {
flex: 1 1 auto;
min-width: 0;
}
.logo-actions {
display: flex;
align-items: center;
gap: 0.5em;
}
.color-switcher-preview {
display: flex;
align-items: center;
gap: 0.4em;
}
.color-switcher-preview.align-right {
justify-content: flex-end;
}
.color-switcher-preview.align-left {
justify-content: flex-start;
}
.color-circle {
width: 24px;
height: 24px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
margin-right: 4px;
cursor: pointer;
box-sizing: border-box;
padding: 0;
}
.color-circle.color-reset {
background: none !important;
}
.logo-tag {
display: inline-block;
background: var(--color-accent, #4f8cff);
color: #fff;
border-radius: 12px;
padding: 0.2em 0.8em;
font-size: 0.85em;
font-weight: 500;
letter-spacing: 0.02em;
margin-right: 0.3em;
margin-top: 0.2em;
margin-bottom: 0.2em;
transition: background 0.2s;
}
.logo-card {
background: var(--color-card);
color: var(--color-text);
border: 1px solid var(--color-border);
border-radius: 8px;
transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
min-width: 320px;
}
</style>