|
20 | 20 | </script>
|
21 | 21 |
|
22 | 22 | <article data-pubdate={pkg.updated}>
|
23 |
| - <header> |
24 |
| - {#snippet title()} |
| 23 | + {#snippet contents()} |
| 24 | + <header> |
25 | 25 | <h3>
|
26 | 26 | {#if pkg.official}
|
27 | 27 | <span data-icon="svelte"></span>
|
28 | 28 | {/if}
|
29 | 29 |
|
30 | 30 | <span>{pkg.name}</span>
|
31 | 31 | </h3>
|
32 |
| - {/snippet} |
33 |
| - |
34 |
| - {#if pkg.homepage} |
35 |
| - <a |
36 |
| - href={pkg.homepage} |
37 |
| - target="_blank" |
38 |
| - rel="noreferrer" |
39 |
| - aria-label="View project homepage" |
40 |
| - onclick={(e) => e.stopPropagation()} |
41 |
| - > |
42 |
| - {@render title()} |
43 |
| - </a> |
44 |
| - {:else} |
45 |
| - {@render title()} |
46 |
| - {/if} |
47 |
| - <span class="updated"> |
48 |
| - {pkg.version} |
49 |
| - |
50 |
| - <strong title={formatter.format(new Date(pkg.updated))}> |
51 |
| - {ago(new Date(pkg.updated), true)} |
52 |
| - </strong> |
53 |
| - </span> |
54 |
| - </header> |
55 | 32 |
|
56 |
| - <p class="description">{pkg.description}</p> |
| 33 | + <span class="updated"> |
| 34 | + {pkg.version} |
57 | 35 |
|
58 |
| - <p class="stats"> |
59 |
| - {#if pkg.downloads} |
60 |
| - <span title="{pkg.downloads} downloads"> |
61 |
| - <span data-icon="download"></span> |
62 |
| - {format_number(+pkg.downloads)} |
| 36 | + <strong title={formatter.format(new Date(pkg.updated))}> |
| 37 | + {ago(new Date(pkg.updated), true)} |
| 38 | + </strong> |
63 | 39 | </span>
|
64 |
| - {/if} |
| 40 | + </header> |
65 | 41 |
|
66 |
| - {#if pkg.github_stars} |
67 |
| - <span title="{pkg.github_stars} Github Stars"> |
68 |
| - <span data-icon="star"></span> |
69 |
| - {format_number(pkg.github_stars)} |
70 |
| - </span> |
71 |
| - {/if} |
| 42 | + <p class="description">{pkg.description}</p> |
72 | 43 |
|
73 |
| - <span style="flex: 1 1 auto"></span> |
| 44 | + <p class="stats"> |
| 45 | + {#if pkg.downloads} |
| 46 | + <span title="{pkg.downloads} downloads"> |
| 47 | + <span data-icon="download"></span> |
| 48 | + {format_number(+pkg.downloads)} |
| 49 | + </span> |
| 50 | + {/if} |
| 51 | + |
| 52 | + {#if pkg.github_stars} |
| 53 | + <span title="{pkg.github_stars} Github Stars"> |
| 54 | + <span data-icon="star"></span> |
| 55 | + {format_number(pkg.github_stars)} |
| 56 | + </span> |
| 57 | + {/if} |
74 | 58 |
|
| 59 | + <span style="flex: 1 1 auto"></span> |
| 60 | + </p> |
| 61 | + {/snippet} |
| 62 | + |
| 63 | + {#if pkg.homepage} |
| 64 | + <a |
| 65 | + class="contents" |
| 66 | + href={pkg.homepage} |
| 67 | + target={pkg.homepage.startsWith('/') ? null : '_blank'} |
| 68 | + rel="noreferrer" |
| 69 | + aria-label="View project homepage" |
| 70 | + onclick={(e) => e.stopPropagation()} |
| 71 | + > |
| 72 | + {@render contents()} |
| 73 | + </a> |
| 74 | + {:else} |
| 75 | + <div class="contents"> |
| 76 | + {@render contents()} |
| 77 | + </div> |
| 78 | + {/if} |
| 79 | + |
| 80 | + <!-- this is a sibling element so that we don't have links inside links --> |
| 81 | + <div class="links"> |
75 | 82 | <span style="display: flex; gap: 0.75rem">
|
76 | 83 | {#if !pkg.svAlias}
|
77 | 84 | <a
|
|
94 | 101 | onclick={(e) => e.stopPropagation()}
|
95 | 102 | ></a>
|
96 | 103 | {/if}
|
97 |
| - |
98 |
| - {#if pkg.homepage} |
99 |
| - <a |
100 |
| - href={pkg.homepage} |
101 |
| - target="_blank" |
102 |
| - rel="noreferrer" |
103 |
| - data-icon="external-link" |
104 |
| - aria-label="View project homepage" |
105 |
| - onclick={(e) => e.stopPropagation()} |
106 |
| - ></a> |
107 |
| - {/if} |
108 | 104 | </span>
|
109 |
| - </p> |
| 105 | + </div> |
110 | 106 | </article>
|
111 | 107 |
|
112 | 108 | <style>
|
|
136 | 132 |
|
137 | 133 | article {
|
138 | 134 | display: grid;
|
139 |
| - grid-template-rows: auto 1fr auto; |
140 |
| - box-sizing: border-box; |
141 |
| -
|
142 |
| - height: 100%; |
143 |
| - min-height: 0; |
144 |
| -
|
145 | 135 | background-color: var(--sk-bg-1);
|
146 | 136 |
|
147 | 137 | border-radius: var(--sk-border-radius);
|
148 | 138 | filter: drop-shadow(0.2rem 0.4rem 0.6rem rgb(0 0 0 / 0.07));
|
149 |
| - padding: 1rem; |
150 | 139 |
|
151 | 140 | min-height: 16em;
|
152 | 141 |
|
|
158 | 147 | filter: drop-shadow(0.3rem 0.5rem 0.7rem rgb(0 0 0 / 0.1));
|
159 | 148 | }
|
160 | 149 |
|
| 150 | + .contents { |
| 151 | + display: grid; |
| 152 | + grid-template-rows: auto 1fr auto; |
| 153 | + box-sizing: border-box; |
| 154 | + padding: 1rem; |
| 155 | +
|
| 156 | + height: 100%; |
| 157 | + min-height: 0; |
| 158 | + } |
| 159 | +
|
| 160 | + .links { |
| 161 | + position: absolute; |
| 162 | + right: 1rem; |
| 163 | + bottom: 1rem; |
| 164 | + } |
| 165 | +
|
161 | 166 | a {
|
162 | 167 | display: block;
|
163 | 168 | text-decoration: none;
|
|
0 commit comments