-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathExamplesGrid.svelte
More file actions
81 lines (72 loc) · 1.96 KB
/
Copy pathExamplesGrid.svelte
File metadata and controls
81 lines (72 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<script lang="ts">
import { resolve } from '$app/paths';
import { useDark } from '$shared/ui';
let { examples } = $props();
const exampleImages: Record<string, any> = import.meta.glob('../../snapshots/*/*.png', {
eager: true,
query: {
enhanced: true,
w: 640
}
});
const ds = useDark();
</script>
<div class="list">
{#each examples as page, i (i)}
<a href={resolve(page.url)}>
<div>
{#if exampleImages[`../../snapshots/${page.key}.png`]}
<enhanced:img
src={ds.isDark
? exampleImages[`../../snapshots/${page.key}.dark.png`].default.img.src
: exampleImages[`../../snapshots/${page.key}.png`].default.img.src}
alt={page.title} />
{/if}
</div>
<h4>
{page.title}
</h4>
</a>
{/each}
</div>
<style>
.list {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
width: 100%;
margin: 2rem 0;
}
.list > a {
display: flex;
flex-direction: column;
align-items: left;
row-gap: 0.3rem;
text-decoration: none;
> div {
border: 1px solid #88888822;
border-radius: 2px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
padding: 1.5ex 1.5ex 0.4ex 1.5ex;
}
&:hover {
text-decoration: underline;
color: var(--svp-text);
> div {
border: 1px solid var(--svp-text);
}
}
}
.list :global(img) {
width: 100%;
box-sizing: border-box;
border-radius: 3px;
transition: transform 0.2s ease-in-out;
}
.list h4 {
margin: 0rem;
font-weight: normal;
font-size: 13px;
line-height: 1;
}
</style>