Skip to content

Commit a520159

Browse files
committed
Add hover description banner to example tiles in welcome modal
1 parent b92bc00 commit a520159

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

src/lib/components/Tooltip.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
let position = typeof params === 'string' ? 'bottom' : (params.position ?? 'bottom');
8383
8484
function handleMouseEnter() {
85-
showTooltip(text, node, position, shortcut, maxWidth);
85+
if (text) showTooltip(text, node, position, shortcut, maxWidth);
8686
}
8787
8888
function handleMouseLeave() {

src/lib/components/WelcomeModal.svelte

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
interface Example {
99
name: string;
10+
description?: string;
1011
file: string;
1112
previewBase: string;
1213
}
@@ -51,6 +52,7 @@
5152
const baseName = filename.replace('.json', '');
5253
return {
5354
name: data.metadata?.name || baseName,
55+
description: data.metadata?.description,
5456
file: `${base}/examples/${filename}`,
5557
previewBase: `${base}/examples/${baseName}`
5658
};
@@ -154,6 +156,9 @@
154156
<div class="example-preview">
155157
<img src="{example.previewBase}-{isDark ? 'dark' : 'light'}.svg" alt="{example.name} preview" />
156158
</div>
159+
{#if example.description}
160+
<div class="example-description">{example.description}</div>
161+
{/if}
157162
</button>
158163
{/each}
159164
</div>
@@ -253,6 +258,7 @@
253258
}
254259
255260
.example-card {
261+
position: relative;
256262
display: flex;
257263
flex-direction: column;
258264
align-items: stretch;
@@ -261,14 +267,34 @@
261267
border: 1px solid var(--border);
262268
border-radius: var(--radius-md);
263269
cursor: pointer;
264-
transition: all 0.15s ease;
270+
transition: transform 0.15s ease;
265271
text-align: left;
266272
overflow: hidden;
267273
font-family: inherit;
268274
}
269275
270276
.example-card:hover {
271-
border-color: var(--accent);
277+
transform: scale(1.03);
278+
}
279+
280+
.example-description {
281+
position: absolute;
282+
bottom: 0;
283+
left: 0;
284+
right: 0;
285+
padding: 6px 8px;
286+
background: color-mix(in srgb, var(--surface) 90%, transparent);
287+
backdrop-filter: blur(4px);
288+
border-top: 1px solid var(--border);
289+
border-radius: 0 0 var(--radius-md) var(--radius-md);
290+
font-size: 10px;
291+
color: var(--text-muted);
292+
opacity: 0;
293+
transition: opacity 0.15s ease;
294+
}
295+
296+
.example-card:hover .example-description {
297+
opacity: 1;
272298
}
273299
274300
.example-preview {

0 commit comments

Comments
 (0)