mirror of
https://github.com/shadoll/sLogos.git
synced 2025-12-20 09:31:59 +00:00
feat: Refactor logo components into Grid and List views
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<script>
|
||||
export let logo;
|
||||
export let onCopy;
|
||||
export let onDownload;
|
||||
|
||||
// Download menu state
|
||||
35
src/components/Grid.svelte
Normal file
35
src/components/Grid.svelte
Normal file
@@ -0,0 +1,35 @@
|
||||
<script>
|
||||
import Preview from './Preview.svelte';
|
||||
import Actions from './Actions.svelte';
|
||||
import Row from './Row.svelte';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
|
||||
export let logos = [];
|
||||
export let onCopy;
|
||||
export let onDownload;
|
||||
|
||||
let showModal = false;
|
||||
let selectedLogo = null;
|
||||
|
||||
export let theme;
|
||||
</script>
|
||||
|
||||
<Preview show={showModal} logo={selectedLogo} theme={theme} on:close={() => showModal = false} />
|
||||
|
||||
<div class="logo-grid">
|
||||
{#each logos as logo}
|
||||
<Row {logo} view="grid" showActions={true} onPreview={() => { selectedLogo = logo; showModal = true; }}>
|
||||
<svelte:fragment slot="actions">
|
||||
<Actions {logo} {onCopy} {onDownload} />
|
||||
</svelte:fragment>
|
||||
</Row>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.logo-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
35
src/components/List.svelte
Normal file
35
src/components/List.svelte
Normal file
@@ -0,0 +1,35 @@
|
||||
<script>
|
||||
import Preview from './Preview.svelte';
|
||||
import Actions from './Actions.svelte';
|
||||
import Row from './Row.svelte';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
|
||||
export let logos = [];
|
||||
export let onCopy;
|
||||
export let onDownload;
|
||||
|
||||
let showModal = false;
|
||||
let selectedLogo = null;
|
||||
|
||||
export let theme;
|
||||
</script>
|
||||
|
||||
<Preview show={showModal} logo={selectedLogo} theme={theme} on:close={() => showModal = false} />
|
||||
|
||||
<div class="logo-list">
|
||||
{#each logos as logo}
|
||||
<Row {logo} view="list" showActions={true} onPreview={() => { selectedLogo = logo; showModal = true; }}>
|
||||
<svelte:fragment slot="actions">
|
||||
<Actions {logo} {onCopy} {onDownload} />
|
||||
</svelte:fragment>
|
||||
</Row>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.logo-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
}
|
||||
</style>
|
||||
@@ -1,196 +0,0 @@
|
||||
<script>
|
||||
import LogoModal from './LogoModal.svelte';
|
||||
import LogoActions from './LogoActions.svelte';
|
||||
import InlineSvg from './InlineSvg.svelte';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { getDefaultLogoColor, getThemeColor } from '../utils/colorTheme.js';
|
||||
|
||||
export let logos = [];
|
||||
export let onCopy;
|
||||
export let onDownload;
|
||||
|
||||
let showModal = false;
|
||||
let selectedLogo = null;
|
||||
|
||||
function openPreview(logo) {
|
||||
selectedLogo = logo;
|
||||
showModal = true;
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
showModal = false;
|
||||
}
|
||||
|
||||
function isSvgLogo(logo) {
|
||||
return logo.format && logo.format.toLowerCase() === 'svg';
|
||||
}
|
||||
|
||||
export let theme;
|
||||
$: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
|
||||
|
||||
// Improved debug logging for color and theme for each logo
|
||||
$: {
|
||||
if (logos && logos.length) {
|
||||
logos.forEach(logo => {
|
||||
if (logo.colors) {
|
||||
const themeColor = getDefaultLogoColor(logo.colors, theme);
|
||||
const fallbackColor = getThemeColor(logo.colors, theme);
|
||||
const activeColor = logo._activeColor || themeColor;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Inline SVG logic for color switching
|
||||
let svgCache = {};
|
||||
|
||||
async function fetchInlineSvg(path) {
|
||||
if (svgCache[path]) return svgCache[path];
|
||||
const res = await fetch(path);
|
||||
const text = await res.text();
|
||||
svgCache[path] = text;
|
||||
return text;
|
||||
}
|
||||
</script>
|
||||
|
||||
<LogoModal show={showModal} logo={selectedLogo} theme={theme} on:close={closeModal} />
|
||||
|
||||
<div class="logo-grid">
|
||||
{#each logos as logo}
|
||||
<div class="logo-card">
|
||||
<div class="logo-image"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Preview {logo.name}"
|
||||
on:click={() => openPreview(logo)}
|
||||
on:keydown={(e) => (e.key === 'Enter' || e.key === ' ') && openPreview(logo)}
|
||||
style="cursor:pointer;"
|
||||
>
|
||||
{#if isSvgLogo(logo)}
|
||||
{#key theme + (logo._activeColor || '')}
|
||||
<InlineSvg
|
||||
path={logo.path}
|
||||
color={logo.colors ? (logo._activeColor || getLogoThemeColor(logo)) : undefined}
|
||||
colorConfig={logo.colors ? logo.colorConfig : undefined}
|
||||
alt={logo.name}
|
||||
/>
|
||||
{/key}
|
||||
{:else}
|
||||
<img src={logo.path} alt={logo.name} />
|
||||
{/if}
|
||||
</div>
|
||||
<div class="logo-info">
|
||||
<h3>{logo.name}</h3>
|
||||
<div class="format-row">
|
||||
<span><strong>Format:</strong> {logo.format}</span>
|
||||
{#if logo.colors}
|
||||
<div class="color-switcher-preview align-right">
|
||||
<span
|
||||
class="color-circle color-reset"
|
||||
title="Reset to theme color"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
aria-label="Reset to theme color"
|
||||
style="background: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; border: none;"
|
||||
on:click|stopPropagation={() => logo._activeColor = undefined}
|
||||
on:keydown|stopPropagation={(e) => (e.key === 'Enter' || e.key === ' ') && (logo._activeColor = undefined)}
|
||||
>
|
||||
<svg width="100%" height="100%" viewBox="0 0 800 800" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<circle cx="400" cy="400" r="400" style="fill:#d6d6d6;"/>
|
||||
<path d="M682.843,117.843l-565.686,565.685c-156.209,-156.21 -156.209,-409.476 0,-565.685c156.21,-156.21 409.476,-156.21 565.686,-0Z" style="fill:#33363f;"/>
|
||||
</svg>
|
||||
</span>
|
||||
{#each logo.colors as colorObj}
|
||||
<span
|
||||
class="color-circle"
|
||||
title={colorObj.label}
|
||||
style="background:{colorObj.value}"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
on:click|stopPropagation={() => logo._activeColor = colorObj.value}
|
||||
on:keydown|stopPropagation={(e) => (e.key === 'Enter' || e.key === ' ') && (logo._activeColor = colorObj.value)}
|
||||
></span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="logo-actions">
|
||||
<LogoActions {logo} {onCopy} {onDownload} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="no-results">No logos found matching your search criteria.</p>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(.logo-card) {
|
||||
background: var(--color-card);
|
||||
color: var(--color-text);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 8px;
|
||||
/* overflow: hidden; removed to allow dropdown menus to escape the card */
|
||||
transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
|
||||
min-width: 320px;
|
||||
}
|
||||
.logo-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||
gap: 1.5rem;
|
||||
}
|
||||
.logo-image {
|
||||
height: 260px;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
position: relative;
|
||||
}
|
||||
.logo-info {
|
||||
padding: 1rem;
|
||||
background: var(--color-card);
|
||||
color: var(--color-text);
|
||||
border-top: 1px solid var(--color-border);
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
.logo-info h3 {
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--color-accent, #4f8cff);
|
||||
}
|
||||
.no-results {
|
||||
grid-column: 1 / -1;
|
||||
text-align: center;
|
||||
padding: 2rem;
|
||||
color: #666;
|
||||
}
|
||||
.color-circle.color-reset {
|
||||
background: none !important;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
}
|
||||
.color-circle.color-reset svg {
|
||||
pointer-events: none;
|
||||
}
|
||||
.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-switcher-preview.align-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@@ -1,187 +0,0 @@
|
||||
<script>
|
||||
import LogoModal from './LogoModal.svelte';
|
||||
import LogoActions from './LogoActions.svelte';
|
||||
import InlineSvg from './InlineSvg.svelte';
|
||||
import { getThemeColor, getDefaultLogoColor } from '../utils/colorTheme.js';
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
|
||||
export let logos = [];
|
||||
export let onCopy;
|
||||
export let onDownload;
|
||||
|
||||
let showModal = false;
|
||||
let selectedLogo = null;
|
||||
|
||||
let theme = getTheme();
|
||||
|
||||
function openPreview(logo) {
|
||||
selectedLogo = logo;
|
||||
showModal = true;
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
showModal = false;
|
||||
}
|
||||
|
||||
function isSvgLogo(logo) {
|
||||
return logo.format && logo.format.toLowerCase() === 'svg';
|
||||
}
|
||||
|
||||
function getTheme() {
|
||||
if (typeof window !== 'undefined' && window.matchMedia) {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
}
|
||||
return 'light';
|
||||
}
|
||||
|
||||
function handleThemeChange(e) {
|
||||
theme = e.matches ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
mql.addEventListener('change', handleThemeChange);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
mql.removeEventListener('change', handleThemeChange);
|
||||
});
|
||||
|
||||
$: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
|
||||
|
||||
// Debug logging for color and theme
|
||||
$: {
|
||||
if (logos && logos.length) {
|
||||
logos.forEach(logo => {
|
||||
if (logo.colors) {
|
||||
const themeColor = getDefaultLogoColor(logo.colors, theme);
|
||||
const activeColor = logo._activeColor || themeColor;
|
||||
console.log('[LogoList] Logo:', logo.name, '| Theme:', theme, '| Theme color:', themeColor, '| Active color:', activeColor);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<LogoModal show={showModal} logo={selectedLogo} on:close={closeModal} />
|
||||
|
||||
<div class="logo-list">
|
||||
{#each logos as logo}
|
||||
<div class="logo-item">
|
||||
<div class="logo-preview"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
aria-label="Preview {logo.name}"
|
||||
on:click={() => openPreview(logo)}
|
||||
on:keydown={(e) => (e.key === 'Enter' || e.key === ' ') && openPreview(logo)}
|
||||
style="cursor:pointer;"
|
||||
>
|
||||
{#if isSvgLogo(logo)}
|
||||
<InlineSvg
|
||||
path={logo.path}
|
||||
color={logo.colors ? (logo._activeColor || getLogoThemeColor(logo)) : undefined}
|
||||
colorConfig={logo.colors ? logo.colorConfig : undefined}
|
||||
alt={logo.name}
|
||||
/>
|
||||
{:else}
|
||||
<img src={logo.path} alt={logo.name} />
|
||||
{/if}
|
||||
</div>
|
||||
<div class="logo-info">
|
||||
<h3>{logo.name}</h3>
|
||||
<div class="format-row">
|
||||
<span><strong>Format:</strong> {logo.format}</span>
|
||||
</div>
|
||||
{#if logo.colors}
|
||||
<div class="color-switcher-preview align-left">
|
||||
<span
|
||||
class="color-circle color-reset"
|
||||
title="Reset to theme color"
|
||||
tabindex="0"
|
||||
role="button"
|
||||
aria-label="Reset to theme color"
|
||||
style="background: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; border: none;"
|
||||
on:click|stopPropagation={() => logo._activeColor = undefined}
|
||||
on:keydown|stopPropagation={(e) => (e.key === 'Enter' || e.key === ' ') && (logo._activeColor = undefined)}
|
||||
>
|
||||
<svg width="100%" height="100%" viewBox="0 0 800 800" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<circle cx="400" cy="400" r="400" style="fill:#d6d6d6;"/>
|
||||
<path d="M682.843,117.843l-565.686,565.685c-156.209,-156.21 -156.209,-409.476 0,-565.685c156.21,-156.21 409.476,-156.21 565.686,-0Z" style="fill:#33363f;"/>
|
||||
</svg>
|
||||
</span>
|
||||
{#each logo.colors as colorObj}
|
||||
<span
|
||||
class="color-circle"
|
||||
title={colorObj.label}
|
||||
style={`background:${colorObj.value}`}
|
||||
tabindex="0"
|
||||
role="button"
|
||||
on:click|stopPropagation={() => logo._activeColor = colorObj.value}
|
||||
on:keydown|stopPropagation={(e) => (e.key === 'Enter' || e.key === ' ') && (logo._activeColor = colorObj.value)}
|
||||
></span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="logo-actions">
|
||||
<LogoActions {logo} {onCopy} {onDownload} />
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<p class="no-results">No logos found matching your search criteria.</p>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
:global(.logo-item) {
|
||||
background: var(--color-card);
|
||||
color: var(--color-text);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 8px;
|
||||
display: grid;
|
||||
grid-template-columns: 80px 2fr 3fr 150px;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 1rem;
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
.logo-preview {
|
||||
height: 100px;
|
||||
width: 80px;
|
||||
padding: 0;
|
||||
border-radius: 4px;
|
||||
position: relative;
|
||||
}
|
||||
.logo-info h3 {
|
||||
margin-bottom: 0.5rem;
|
||||
color: var(--color-accent, #4f8cff);
|
||||
}
|
||||
.logo-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
.no-results {
|
||||
text-align: center;
|
||||
padding: 2rem;
|
||||
color: #666;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.color-switcher-preview.align-left {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.color-circle.color-reset {
|
||||
background: none !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,9 @@
|
||||
<script>
|
||||
import { onMount, onDestroy, createEventDispatcher } from 'svelte';
|
||||
import InlineSvg from './InlineSvg.svelte';
|
||||
import { getDefaultLogoColor, getThemeColor } from '../utils/colorTheme.js';
|
||||
import { getDefaultLogoColor } from '../utils/colorTheme.js';
|
||||
import tagsData from '../../public/data/tags.json';
|
||||
console.log('Loaded tagsData:', tagsData);
|
||||
|
||||
export let show = false;
|
||||
export let logo = null;
|
||||
@@ -22,21 +24,34 @@
|
||||
return logo && logo.format && logo.format.toLowerCase() === 'svg';
|
||||
}
|
||||
|
||||
// Helper to get tag object from tags.json by text
|
||||
function getTagObj(text) {
|
||||
const tag = tagsData && typeof tagsData === 'object' && tagsData[text] ? { text, ...tagsData[text] } : { text };
|
||||
console.log('[LogoModal] Tag lookup:', text, tag, tagsData);
|
||||
return tag;
|
||||
}
|
||||
|
||||
// Always use $theme directly, do not cache in a function
|
||||
export let theme;
|
||||
$: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
|
||||
|
||||
// Improved debug logging for color and theme
|
||||
$: {
|
||||
if (logo && logo.colors) {
|
||||
const themeColor = getDefaultLogoColor(logo.colors, theme);
|
||||
const fallbackColor = getThemeColor(logo.colors, theme);
|
||||
const activeColor = logo._activeColor || themeColor;
|
||||
}
|
||||
}
|
||||
|
||||
$: if (logo && logo.tags && logo.tags.length) {
|
||||
logo.tags.forEach(tag => {
|
||||
console.log('[LogoModal] Tag:', tag);
|
||||
getTagObj(tag);
|
||||
});
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
document.addEventListener('keydown', handleKeydown);
|
||||
console.log('[LogoModal] Mounted, added keydown event listener');
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@@ -113,8 +128,12 @@ $: getLogoThemeColor = logo => getDefaultLogoColor(logo.colors, theme);
|
||||
<p><strong>Path:</strong> {logo.path}</p>
|
||||
{#if logo.tags && logo.tags.length}
|
||||
<div class="logo-tags">
|
||||
{#each logo.tags as tagObj}
|
||||
<span class="logo-tag" style={tagObj.color ? `background:${tagObj.color}` : ''}>{tagObj.text || tagObj}</span>
|
||||
{#each logo.tags as tag}
|
||||
{#if getTagObj(tag).color}
|
||||
<span class="logo-tag" style={`background:${getTagObj(tag).color}`}>{getTagObj(tag).text}</span>
|
||||
{:else}
|
||||
<span class="logo-tag">{getTagObj(tag).text}</span>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
167
src/components/Row.svelte
Normal file
167
src/components/Row.svelte
Normal file
@@ -0,0 +1,167 @@
|
||||
<script>
|
||||
export let logo;
|
||||
export let onCopy;
|
||||
export let onDownload;
|
||||
export let view = 'grid'; // or 'list'
|
||||
export let showActions = true;
|
||||
export let onPreview = null;
|
||||
import InlineSvg from './InlineSvg.svelte';
|
||||
import { getDefaultLogoColor } from '../utils/colorTheme.js';
|
||||
import tagsData from '../../public/data/tags.json';
|
||||
function getTagObj(text) {
|
||||
return tagsData[text] ? { text, ...tagsData[text] } : { text };
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="logo-row {view}">
|
||||
<div
|
||||
class="logo-img"
|
||||
on:click={onPreview}
|
||||
on:keydown={(e) => (e.key === 'Enter' || e.key === ' ') && onPreview && onPreview(e)}
|
||||
tabindex="0"
|
||||
role="button"
|
||||
aria-label="Preview logo"
|
||||
>
|
||||
{#if logo.format && logo.format.toLowerCase() === 'svg'}
|
||||
<InlineSvg path={logo.path} color={logo.colors ? (logo._activeColor || getDefaultLogoColor(logo.colors)) : undefined} colorConfig={logo.colors ? logo.colorConfig : undefined} alt={logo.name} />
|
||||
{:else}
|
||||
<img src={logo.path} alt={logo.name} />
|
||||
{/if}
|
||||
</div>
|
||||
<div class="logo-info">
|
||||
<h3>{logo.name}</h3>
|
||||
<div class="format-row">
|
||||
<span><strong>Format:</strong> {logo.format}</span>
|
||||
{#if logo.colors}
|
||||
<div class="color-switcher-preview {view === 'grid' ? 'align-right' : 'align-left'}">
|
||||
<span class="color-circle color-reset" title="Reset to theme color" tabindex="0" role="button" aria-label="Reset to theme color" style="background: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; margin: 0; border: none;"
|
||||
on:click|stopPropagation={() => logo._activeColor = undefined}
|
||||
on:keydown|stopPropagation={(e) => (e.key === 'Enter' || e.key === ' ') && (logo._activeColor = undefined)}>
|
||||
<svg width="100%" height="100%" viewBox="0 0 800 800" version="1.1" xmlns="http://www.w3.org/2000/svg" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<circle cx="400" cy="400" r="400" style="fill:#d6d6d6;"/>
|
||||
<path d="M682.843,117.843l-565.686,565.685c-156.209,-156.21 -156.209,-409.476 0,-565.685c156.21,-156.21 409.476,-156.21 565.686,-0Z" style="fill:#33363f;"/>
|
||||
</svg>
|
||||
</span>
|
||||
{#each logo.colors as colorObj}
|
||||
<span class="color-circle" title={colorObj.label} style={`background:${colorObj.value}`} tabindex="0" role="button"
|
||||
on:click|stopPropagation={() => logo._activeColor = colorObj.value}
|
||||
on:keydown|stopPropagation={(e) => (e.key === 'Enter' || e.key === ' ') && (logo._activeColor = colorObj.value)}></span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if logo.tags && logo.tags.length}
|
||||
<div class="logo-tags">
|
||||
{#each logo.tags as tag}
|
||||
{#if getTagObj(tag).color}
|
||||
<span class="logo-tag" style={`background:${getTagObj(tag).color}`}>{getTagObj(tag).text}</span>
|
||||
{:else}
|
||||
<span class="logo-tag">{getTagObj(tag).text}</span>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
<slot name="extra" />
|
||||
</div>
|
||||
{#if showActions}
|
||||
<div class="logo-actions">
|
||||
<slot name="actions" />
|
||||
</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>
|
||||
Reference in New Issue
Block a user