@@ -17,34 +17,46 @@ const displayDatetime = format(date, 'dd LLL yyyy');
1717
1818const slug = ` /posts/${post .id }/ ` ;
1919const primaryTag = tags ?.[0 ];
20- const words = ( post .body ?.split (/ \s + / ).length ) ?? 0 ;
20+ const words = post .body ?.split (/ \s + / ).length ?? 0 ;
2121const readingTime = ` ${Math .max (1 , Math .ceil (words / 265 ))} min read ` ;
2222---
2323
2424<article class:list ={ [' post-card' , { ' no-image' : ! image , ' post-card-large' : large }]} >
25- { image && (
26- <div class = " post-card-image" >
27- <Image src = { image } alt = { title } width = { 720 } height = { 400 } loading = { eager ? ' eager' : ' lazy' } />
28- </div >
29- )}
25+ {
26+ image && (
27+ <div class = " post-card-image" >
28+ <Image
29+ src = { image }
30+ alt = { title }
31+ width = { 720 }
32+ height = { 400 }
33+ loading = { eager ? ' eager' : ' lazy' }
34+ />
35+ </div >
36+ )
37+ }
3038 <div class =" post-card-body" >
31- { primaryTag && (
32- <span class = " post-card-tag" >
33- <a href = { ` /tags/${primaryTag .toLowerCase ().replace (/ \s + / g , ' -' )}/ ` } >{ primaryTag } </a >
34- </span >
35- )}
39+ {
40+ primaryTag && (
41+ <span class = " post-card-tag" >
42+ <a href = { ` /tags/${primaryTag .toLowerCase ().replace (/ \s + / g , ' -' )}/ ` } >{ primaryTag } </a >
43+ </span >
44+ )
45+ }
3646 <h2 class =" post-card-title" >
3747 <a href ={ slug } class =" post-card-link" >{ title } </a >
3848 </h2 >
3949 { excerpt && <p class = " post-card-excerpt" >{ excerpt } </p >}
4050 <footer class =" post-card-meta" >
4151 <span class =" post-card-authors" >
42- { author .map ((authorId , i ) => (
43- <>
44- <a href = { ` /author/${authorId .toLowerCase ()}/ ` } >{ authorId } </a >
45- { i < author .length - 1 && ' , ' }
46- </>
47- ))}
52+ {
53+ author .map ((authorId , i ) => (
54+ <>
55+ <a href = { ` /author/${authorId .toLowerCase ()}/ ` } >{ authorId } </a >
56+ { i < author .length - 1 && ' , ' }
57+ </>
58+ ))
59+ }
4860 </span >
4961 <time datetime ={ datetime } >{ displayDatetime } </time >
5062 <span class =" post-card-reading-time" >{ readingTime } </span >
@@ -60,11 +72,17 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
6072 background: #fff;
6173 border-radius: 12px;
6274 overflow: hidden;
63- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
64- transition: box-shadow 0.25s ease, transform 0.25s ease;
75+ box-shadow:
76+ 0 1px 3px rgba(0, 0, 0, 0.08),
77+ 0 1px 2px rgba(0, 0, 0, 0.06);
78+ transition:
79+ box-shadow 0.25s ease,
80+ transform 0.25s ease;
6581 }
6682 .post-card:hover {
67- box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.08);
83+ box-shadow:
84+ 0 12px 28px rgba(0, 0, 0, 0.12),
85+ 0 4px 10px rgba(0, 0, 0, 0.08);
6886 transform: translateY(-2px);
6987 }
7088
@@ -84,7 +102,9 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
84102 min-height: 320px;
85103 }
86104 @media (max-width: 800px) {
87- .post-card-large { flex-direction: column; }
105+ .post-card-large {
106+ flex-direction: column;
107+ }
88108 }
89109
90110 /* Stretched link: the title <a> covers the entire card */
@@ -122,10 +142,14 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
122142 aspect-ratio: auto;
123143 }
124144 @media (max-width: 800px) {
125- .post-card-large .post-card-image { aspect-ratio: 16 / 9; }
145+ .post-card-large .post-card-image {
146+ aspect-ratio: 16 / 9;
147+ }
126148 }
127149 @media (prefers-color-scheme: dark) {
128- .post-card-image { background: var(--color-darkmode); }
150+ .post-card-image {
151+ background: var(--color-darkmode);
152+ }
129153 }
130154
131155 .post-card-body {
@@ -140,7 +164,9 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
140164 padding: 32px 36px;
141165 }
142166 @media (max-width: 800px) {
143- .post-card-large .post-card-body { padding: 20px 24px 24px; }
167+ .post-card-large .post-card-body {
168+ padding: 20px 24px 24px;
169+ }
144170 }
145171
146172 .post-card-tag {
@@ -173,7 +199,9 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
173199 font-size: 2.8rem;
174200 }
175201 @media (prefers-color-scheme: dark) {
176- .post-card-title { color: rgba(255, 255, 255, 0.92); }
202+ .post-card-title {
203+ color: rgba(255, 255, 255, 0.92);
204+ }
177205 }
178206
179207 .post-card-excerpt {
@@ -187,7 +215,9 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
187215 font-size: 1.6rem;
188216 }
189217 @media (prefers-color-scheme: dark) {
190- .post-card-excerpt { color: rgba(255, 255, 255, 0.55); }
218+ .post-card-excerpt {
219+ color: rgba(255, 255, 255, 0.55);
220+ }
191221 }
192222
193223 .post-card-meta {
@@ -198,7 +228,9 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
198228 color: var(--color-midgrey-l10);
199229 letter-spacing: 0.2px;
200230 }
201- .post-card-meta time { white-space: nowrap; }
231+ .post-card-meta time {
232+ white-space: nowrap;
233+ }
202234 .post-card-meta time::before {
203235 content: '\00b7';
204236 margin-right: 6px;
@@ -212,8 +244,12 @@ const readingTime = `${Math.max(1, Math.ceil(words / 265))} min read`;
212244 font-weight: 600;
213245 text-decoration: none;
214246 }
215- .post-card-authors a:hover { text-decoration: underline; }
247+ .post-card-authors a:hover {
248+ text-decoration: underline;
249+ }
216250 @media (prefers-color-scheme: dark) {
217- .post-card-authors a { color: rgba(255, 255, 255, 0.75); }
251+ .post-card-authors a {
252+ color: rgba(255, 255, 255, 0.75);
253+ }
218254 }
219255</style >
0 commit comments