mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 21:46:35 +00:00
fix: use toolcard as links at list page
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
import EmptyState from '../ui/EmptyState.svelte';
|
import EmptyState from '../ui/EmptyState.svelte';
|
||||||
import ParamsCard from '../tool/ParamsCard.svelte';
|
import ParamsCard from '../tool/ParamsCard.svelte';
|
||||||
import Preview from '../Preview.svelte';
|
import Preview from '../Preview.svelte';
|
||||||
|
import { TOOL_ICONS } from '$lib/tools/tool-icons';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -37,11 +38,15 @@
|
|||||||
|
|
||||||
const format = $derived(outputOf(tool));
|
const format = $derived(outputOf(tool));
|
||||||
const safeParams = $derived(sanitizeParams(tool, values));
|
const safeParams = $derived(sanitizeParams(tool, values));
|
||||||
|
const StepIcon = $derived(TOOL_ICONS[tool.id]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<div class="panel tool-stage">
|
<div class="panel tool-stage">
|
||||||
<span class="edge-legend step-legend">
|
<span class="edge-legend step-legend">
|
||||||
|
{#if StepIcon}
|
||||||
|
<span class="step-icon" aria-hidden="true"><StepIcon size={14} strokeWidth={2} /></span>
|
||||||
|
{/if}
|
||||||
Шаг {index + 1}: {tool.title}
|
Шаг {index + 1}: {tool.title}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -118,6 +123,17 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.step-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 1.4rem;
|
||||||
|
height: 1.4rem;
|
||||||
|
border-radius: var(--radius-s);
|
||||||
|
background: color-mix(in srgb, var(--accent) 10%, var(--surface));
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
.remove {
|
.remove {
|
||||||
width: 1.4rem;
|
width: 1.4rem;
|
||||||
height: 1.4rem;
|
height: 1.4rem;
|
||||||
|
|||||||
@@ -6,27 +6,25 @@
|
|||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
|
href?: string;
|
||||||
onActivate?: () => void;
|
onActivate?: () => void;
|
||||||
onHover?: () => void;
|
onHover?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { toolId, title, description, selected = false, onActivate, onHover }: Props = $props();
|
let {
|
||||||
|
toolId,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
selected = false,
|
||||||
|
href,
|
||||||
|
onActivate,
|
||||||
|
onHover
|
||||||
|
}: Props = $props();
|
||||||
|
|
||||||
const Icon = $derived(TOOL_ICONS[toolId]);
|
const Icon = $derived(TOOL_ICONS[toolId]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
{#snippet content()}
|
||||||
class="card"
|
|
||||||
class:selected
|
|
||||||
role="option"
|
|
||||||
aria-selected={selected}
|
|
||||||
tabindex="-1"
|
|
||||||
onclick={onActivate}
|
|
||||||
onmousemove={onHover}
|
|
||||||
onkeydown={(e) => {
|
|
||||||
if (e.key === 'Enter') onActivate?.();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="icon-box" aria-hidden="true">
|
<span class="icon-box" aria-hidden="true">
|
||||||
{#if Icon}<Icon size={24} strokeWidth={1.75} />{/if}
|
{#if Icon}<Icon size={24} strokeWidth={1.75} />{/if}
|
||||||
</span>
|
</span>
|
||||||
@@ -34,7 +32,33 @@
|
|||||||
<span class="title">{title}</span>
|
<span class="title">{title}</span>
|
||||||
<span class="hint text-caption text-muted">{description}</span>
|
<span class="hint text-caption text-muted">{description}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
{/snippet}
|
||||||
|
|
||||||
|
{#if href}
|
||||||
|
<a
|
||||||
|
{href}
|
||||||
|
class="card"
|
||||||
|
class:selected
|
||||||
|
onmousemove={onHover}
|
||||||
|
>
|
||||||
|
{@render content()}
|
||||||
|
</a>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class="card"
|
||||||
|
class:selected
|
||||||
|
role="option"
|
||||||
|
aria-selected={selected}
|
||||||
|
tabindex="-1"
|
||||||
|
onclick={onActivate}
|
||||||
|
onmousemove={onHover}
|
||||||
|
onkeydown={(e) => {
|
||||||
|
if (e.key === 'Enter') onActivate?.();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{@render content()}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.card {
|
.card {
|
||||||
@@ -46,6 +70,8 @@
|
|||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: var(--radius-s);
|
border-radius: var(--radius-s);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:hover,
|
.card:hover,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { CATEGORIES } from '$lib/categories';
|
import { CATEGORIES } from '$lib/categories';
|
||||||
|
import ToolCard from '$lib/components/search/ToolCard.svelte';
|
||||||
import { TOOLS } from '$lib/registry';
|
import { TOOLS } from '$lib/registry';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -23,10 +24,14 @@
|
|||||||
<h2 id="{category.id}-heading" class="heading-section">{category.label}</h2>
|
<h2 id="{category.id}-heading" class="heading-section">{category.label}</h2>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
{#each categoryTools as tool (tool.id)}
|
{#each categoryTools as tool (tool.id)}
|
||||||
<a class="card panel" href="/tools/{tool.id}">
|
<div class="panel">
|
||||||
<span class="card-title">{tool.title}</span>
|
<ToolCard
|
||||||
<span class="card-desc text-caption text-muted">{tool.description}</span>
|
toolId={tool.id}
|
||||||
</a>
|
title={tool.title}
|
||||||
|
description={tool.description}
|
||||||
|
href="/tools/{tool.id}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -58,39 +63,17 @@
|
|||||||
gap: var(--space-3);
|
gap: var(--space-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.grid > .panel {
|
||||||
display: flex;
|
padding: var(--space-2) var(--space-2) var(--space-3);
|
||||||
flex-direction: column;
|
|
||||||
gap: var(--space-2);
|
|
||||||
padding: var(--space-3) var(--space-3) var(--space-4);
|
|
||||||
color: inherit;
|
|
||||||
transition:
|
transition:
|
||||||
border-color var(--transition-fast),
|
border-color var(--transition-fast),
|
||||||
box-shadow var(--transition-fast),
|
box-shadow var(--transition-fast),
|
||||||
transform var(--transition-fast);
|
transform var(--transition-fast);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:hover {
|
.grid > .panel:hover {
|
||||||
text-decoration: none;
|
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
box-shadow: var(--shadow-card);
|
box-shadow: var(--shadow-card);
|
||||||
transform: translateY(-1px);
|
transform: translateY(-1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-title {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: var(--text-m);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:hover .card-title {
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-desc {
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user