Skip to content

Commit 99f4f63

Browse files
authored
Merge pull request #228 from pathsim/feature/welcome-modal-hover-description
welcome modal hover description
2 parents a7050d5 + f685738 commit 99f4f63

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

src/lib/components/WelcomeModal.svelte

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@
152152
<button class="example-card" onclick={() => handleExample(example.file)}>
153153
<div class="example-info">
154154
<div class="example-name">{example.name}</div>
155+
{#if example.description}
156+
<div class="example-description">{example.description}</div>
157+
{/if}
155158
</div>
156159
<div class="example-preview">
157160
<img src="{example.previewBase}-{isDark ? 'dark' : 'light'}.svg" alt="{example.name} preview" />
158161
</div>
159-
{#if example.description}
160-
<div class="example-description">{example.description}</div>
161-
{/if}
162162
</button>
163163
{/each}
164164
</div>
@@ -268,38 +268,52 @@
268268
border: 1px solid var(--border);
269269
border-radius: var(--radius-md);
270270
cursor: pointer;
271-
transition: transform 0.15s ease;
272271
text-align: left;
273272
overflow: hidden;
274273
font-family: inherit;
275274
}
276275
277-
.example-card:hover {
278-
transform: scale(1.03);
279-
}
280276
281-
.example-description {
277+
.example-info {
282278
position: absolute;
283-
bottom: 0;
279+
top: 0;
284280
left: 0;
285281
right: 0;
282+
z-index: 1;
286283
padding: 6px 8px;
284+
text-align: left;
287285
background: var(--surface);
288-
border-top: 1px solid var(--border);
289-
border-radius: 0 0 var(--radius-md) var(--radius-md);
286+
border-bottom: 1px solid var(--border);
287+
border-radius: var(--radius-md) var(--radius-md) 0 0;
288+
transition: padding 0.15s ease;
289+
}
290+
291+
292+
.example-name {
293+
font-size: 11px;
294+
font-weight: 500;
295+
color: var(--text-muted);
296+
}
297+
298+
.example-description {
290299
font-size: 10px;
291300
color: var(--text-muted);
301+
max-height: 0;
302+
overflow: hidden;
292303
opacity: 0;
293-
transition: opacity 0.15s ease;
304+
transition: max-height 0.15s ease, opacity 0.15s ease, margin 0.15s ease;
294305
}
295306
296307
.example-card:hover .example-description {
308+
max-height: 100px;
297309
opacity: 1;
310+
margin-top: 4px;
298311
}
299312
300313
.example-preview {
301314
background: var(--surface);
302315
width: 100%;
316+
padding-top: 28px; /* Space for the header */
303317
}
304318
305319
.example-preview img {
@@ -308,18 +322,6 @@
308322
height: auto;
309323
}
310324
311-
.example-info {
312-
padding: 6px 8px;
313-
text-align: left;
314-
border-bottom: 1px solid var(--border);
315-
}
316-
317-
.example-name {
318-
font-size: 11px;
319-
font-weight: 500;
320-
color: var(--text-muted);
321-
}
322-
323325
@media (max-width: 700px) {
324326
.examples-grid {
325327
grid-template-columns: repeat(2, 1fr);

0 commit comments

Comments
 (0)