|
152 | 152 | <button class="example-card" onclick={() => handleExample(example.file)}> |
153 | 153 | <div class="example-info"> |
154 | 154 | <div class="example-name">{example.name}</div> |
| 155 | + {#if example.description} |
| 156 | + <div class="example-description">{example.description}</div> |
| 157 | + {/if} |
155 | 158 | </div> |
156 | 159 | <div class="example-preview"> |
157 | 160 | <img src="{example.previewBase}-{isDark ? 'dark' : 'light'}.svg" alt="{example.name} preview" /> |
158 | 161 | </div> |
159 | | - {#if example.description} |
160 | | - <div class="example-description">{example.description}</div> |
161 | | - {/if} |
162 | 162 | </button> |
163 | 163 | {/each} |
164 | 164 | </div> |
|
268 | 268 | border: 1px solid var(--border); |
269 | 269 | border-radius: var(--radius-md); |
270 | 270 | cursor: pointer; |
271 | | - transition: transform 0.15s ease; |
272 | 271 | text-align: left; |
273 | 272 | overflow: hidden; |
274 | 273 | font-family: inherit; |
275 | 274 | } |
276 | 275 |
|
277 | | - .example-card:hover { |
278 | | - transform: scale(1.03); |
279 | | - } |
280 | 276 |
|
281 | | - .example-description { |
| 277 | + .example-info { |
282 | 278 | position: absolute; |
283 | | - bottom: 0; |
| 279 | + top: 0; |
284 | 280 | left: 0; |
285 | 281 | right: 0; |
| 282 | + z-index: 1; |
286 | 283 | padding: 6px 8px; |
| 284 | + text-align: left; |
287 | 285 | 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 { |
290 | 299 | font-size: 10px; |
291 | 300 | color: var(--text-muted); |
| 301 | + max-height: 0; |
| 302 | + overflow: hidden; |
292 | 303 | opacity: 0; |
293 | | - transition: opacity 0.15s ease; |
| 304 | + transition: max-height 0.15s ease, opacity 0.15s ease, margin 0.15s ease; |
294 | 305 | } |
295 | 306 |
|
296 | 307 | .example-card:hover .example-description { |
| 308 | + max-height: 100px; |
297 | 309 | opacity: 1; |
| 310 | + margin-top: 4px; |
298 | 311 | } |
299 | 312 |
|
300 | 313 | .example-preview { |
301 | 314 | background: var(--surface); |
302 | 315 | width: 100%; |
| 316 | + padding-top: 28px; /* Space for the header */ |
303 | 317 | } |
304 | 318 |
|
305 | 319 | .example-preview img { |
|
308 | 322 | height: auto; |
309 | 323 | } |
310 | 324 |
|
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 | | -
|
323 | 325 | @media (max-width: 700px) { |
324 | 326 | .examples-grid { |
325 | 327 | grid-template-columns: repeat(2, 1fr); |
|
0 commit comments