ferst-core 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +63 -31
- package/README.md +13 -4
- package/bin/ferst-media.mjs +96 -0
- package/bin/ferst-modules.mjs +17 -2
- package/components/BlockRenderer.astro +131 -129
- package/components/Card.astro +53 -51
- package/components/MembersAccount.astro +370 -0
- package/components/PostCard.astro +138 -136
- package/components/SiteHeader.astro +32 -14
- package/components/blocks/Grid.astro +49 -48
- package/components/blocks/Heading.astro +4 -1
- package/components/islands/BookMonth.tsx +95 -0
- package/components/islands/MembersAccount.tsx +392 -0
- package/components/recipes/Banner.astro +146 -146
- package/components/recipes/Book.astro +1147 -926
- package/components/recipes/FeatureCards.astro +112 -118
- package/components/recipes/Gallery.astro +57 -59
- package/components/recipes/Hero.astro +112 -10
- package/components/recipes/LatestPosts.astro +295 -292
- package/components/recipes/Locations.astro +146 -143
- package/components/recipes/Marquee.astro +75 -75
- package/components/recipes/MediaCards.astro +213 -219
- package/components/recipes/MembersContent.astro +176 -0
- package/components/recipes/Pricing.astro +149 -150
- package/components/recipes/Stats.astro +150 -157
- package/components/recipes/Tiles.astro +342 -296
- package/content/blocks.ts +1091 -1024
- package/content/cookies.ts +14 -0
- package/content/imageSlots.mjs +542 -0
- package/content/recipe-questions.ts +81 -80
- package/content/schemas.ts +13 -11
- package/examples/recipes.ts +5 -0
- package/fonts/OFL.txt +1332 -287
- package/fonts/anton-latin-400-normal.woff2 +0 -0
- package/fonts/bangers-latin-400-normal.woff2 +0 -0
- package/fonts/bebas-neue-latin-400-normal.woff2 +0 -0
- package/fonts/bowlby-one-latin-400-normal.woff2 +0 -0
- package/fonts/fredoka-latin-400-normal.woff2 +0 -0
- package/fonts/fredoka-latin-600-normal.woff2 +0 -0
- package/fonts/fredoka-latin-700-normal.woff2 +0 -0
- package/fonts/knewave-latin-400-normal.woff2 +0 -0
- package/fonts/lora-latin-400-normal.woff2 +0 -0
- package/fonts/lora-latin-600-normal.woff2 +0 -0
- package/fonts/lora-latin-700-normal.woff2 +0 -0
- package/fonts/merriweather-latin-400-normal.woff2 +0 -0
- package/fonts/merriweather-latin-600-normal.woff2 +0 -0
- package/fonts/merriweather-latin-700-normal.woff2 +0 -0
- package/fonts/nunito-latin-400-normal.woff2 +0 -0
- package/fonts/nunito-latin-600-normal.woff2 +0 -0
- package/fonts/nunito-latin-700-normal.woff2 +0 -0
- package/fonts/oswald-latin-400-normal.woff2 +0 -0
- package/fonts/oswald-latin-600-normal.woff2 +0 -0
- package/fonts/oswald-latin-700-normal.woff2 +0 -0
- package/fonts/rubik-dirt-latin-400-normal.woff2 +0 -0
- package/integration.mjs +319 -263
- package/layouts/Base.astro +8 -16
- package/lib/book.ts +416 -378
- package/lib/fonts.ts +130 -0
- package/lib/gridRows.ts +197 -0
- package/lib/image-fields.ts +140 -0
- package/lib/image-size.mjs +108 -73
- package/lib/image-sizes.ts +16 -0
- package/lib/logo-header.ts +46 -0
- package/lib/media-check.mjs +524 -0
- package/lib/members-account.ts +276 -0
- package/lib/members.ts +115 -0
- package/lib/theme-preview.ts +203 -140
- package/lib/themeTokens.ts +235 -220
- package/package.json +80 -71
- package/routes/account.astro +16 -0
- package/routes/cookie-policy.astro +28 -28
- package/styles/fonts.css +239 -76
- package/styles/theme.css +228 -160
- package/lib/gridColumns.ts +0 -22
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* MembersAccount — the members' account page's content (`/account`, the Ferst Members module):
|
|
4
|
+
* signing in with an emailed code, and the member's own account. The page's title is built; the
|
|
5
|
+
* rest is a React island (components/islands/MembersAccount.tsx, docs/BLOCK-ARCHITECTURE.md §8),
|
|
6
|
+
* drawn in the browser only, since it all depends on who is visiting. The island brings no look of
|
|
7
|
+
* its own: this file styles it from the site's tokens, in light and dark, and with the site's field
|
|
8
|
+
* treatment (`data-field` on <html>).
|
|
9
|
+
*
|
|
10
|
+
* Used by the injected route (routes/account.astro) and the showcase.
|
|
11
|
+
*/
|
|
12
|
+
import MembersAccountIsland from './islands/MembersAccount.tsx';
|
|
13
|
+
import { ACCOUNT_TEXT } from '../lib/members-account';
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<section class="m-account" aria-labelledby="m-account-title">
|
|
17
|
+
<h1 id="m-account-title" class="m-account__title">{ACCOUNT_TEXT.title}</h1>
|
|
18
|
+
<MembersAccountIsland client:only="react">
|
|
19
|
+
<p slot="fallback" class="m-account__wait">{ACCOUNT_TEXT.loading}</p>
|
|
20
|
+
</MembersAccountIsland>
|
|
21
|
+
<noscript><p class="m-account__notice">{ACCOUNT_TEXT.noScript}</p></noscript>
|
|
22
|
+
</section>
|
|
23
|
+
|
|
24
|
+
<style is:global>
|
|
25
|
+
/* The island's markup isn't the build's, so these rules are global, every one under .m-account. */
|
|
26
|
+
.m-account {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: 1.25rem;
|
|
30
|
+
max-width: 34rem;
|
|
31
|
+
margin: 0 auto;
|
|
32
|
+
padding: clamp(2rem, 6vw, 4rem) 1rem;
|
|
33
|
+
color: var(--fg);
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
.m-account__title {
|
|
37
|
+
margin: 0;
|
|
38
|
+
font-family: var(--font-heading);
|
|
39
|
+
font-size: clamp(1.75rem, 4vw, 2.25rem);
|
|
40
|
+
line-height: 1.2;
|
|
41
|
+
color: var(--fg);
|
|
42
|
+
}
|
|
43
|
+
.m-account__app,
|
|
44
|
+
.m-account__card {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: 1.1rem;
|
|
48
|
+
}
|
|
49
|
+
.m-account__card {
|
|
50
|
+
padding: clamp(1.25rem, 4vw, 2rem);
|
|
51
|
+
border: var(--card-border, 1px solid var(--border));
|
|
52
|
+
border-radius: var(--radius);
|
|
53
|
+
background: var(--bg-surface);
|
|
54
|
+
box-shadow: var(--shadow-sm);
|
|
55
|
+
}
|
|
56
|
+
.m-account__step,
|
|
57
|
+
.m-account__part-title {
|
|
58
|
+
margin: 0;
|
|
59
|
+
font-family: var(--font-heading);
|
|
60
|
+
font-size: 1.25rem;
|
|
61
|
+
line-height: 1.3;
|
|
62
|
+
color: var(--fg);
|
|
63
|
+
overflow-wrap: anywhere;
|
|
64
|
+
}
|
|
65
|
+
.m-account__part-title {
|
|
66
|
+
font-size: 1.05rem;
|
|
67
|
+
}
|
|
68
|
+
.m-account__step:focus {
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
.m-account__step:focus-visible {
|
|
72
|
+
outline: 2px solid var(--gold);
|
|
73
|
+
outline-offset: 4px;
|
|
74
|
+
}
|
|
75
|
+
.m-account__intro,
|
|
76
|
+
.m-account__status,
|
|
77
|
+
.m-account__wait,
|
|
78
|
+
.m-account__back {
|
|
79
|
+
margin: 0;
|
|
80
|
+
line-height: 1.6;
|
|
81
|
+
}
|
|
82
|
+
.m-account__intro,
|
|
83
|
+
.m-account__wait {
|
|
84
|
+
color: var(--muted);
|
|
85
|
+
}
|
|
86
|
+
.m-account__status {
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
}
|
|
89
|
+
.m-account__welcome {
|
|
90
|
+
margin: 0;
|
|
91
|
+
padding: 1rem 1.1rem;
|
|
92
|
+
border-inline-start: 4px solid var(--gold);
|
|
93
|
+
border-radius: var(--radius-sm);
|
|
94
|
+
background: var(--bg-section);
|
|
95
|
+
line-height: 1.6;
|
|
96
|
+
white-space: pre-line;
|
|
97
|
+
}
|
|
98
|
+
.m-account a {
|
|
99
|
+
color: var(--accent);
|
|
100
|
+
text-decoration: underline;
|
|
101
|
+
text-underline-offset: 0.15em;
|
|
102
|
+
}
|
|
103
|
+
.m-account a:focus-visible {
|
|
104
|
+
outline: 2px solid var(--gold);
|
|
105
|
+
outline-offset: 2px;
|
|
106
|
+
border-radius: 2px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* What just happened: told once, in the site's colours. */
|
|
110
|
+
.m-account__notice {
|
|
111
|
+
margin: 0;
|
|
112
|
+
padding: 0.85rem 1rem;
|
|
113
|
+
border: 1px solid var(--border);
|
|
114
|
+
border-radius: var(--radius-sm);
|
|
115
|
+
background: var(--bg-section);
|
|
116
|
+
color: var(--fg);
|
|
117
|
+
line-height: 1.5;
|
|
118
|
+
}
|
|
119
|
+
.m-account__notice--done {
|
|
120
|
+
border-color: var(--gold);
|
|
121
|
+
background: var(--gold-light);
|
|
122
|
+
}
|
|
123
|
+
.m-account__notice--error {
|
|
124
|
+
border-color: var(--fg);
|
|
125
|
+
border-inline-start-width: 4px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Fields, as every form on the site has them (the ContactForm's treatment). */
|
|
129
|
+
.m-account__form {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
gap: 1rem;
|
|
133
|
+
}
|
|
134
|
+
.m-account__form--row {
|
|
135
|
+
flex-flow: row wrap;
|
|
136
|
+
align-items: flex-end;
|
|
137
|
+
}
|
|
138
|
+
.m-account__form--row .m-account__field {
|
|
139
|
+
flex: 1 1 14rem;
|
|
140
|
+
}
|
|
141
|
+
.m-account__field {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
gap: 0.4rem;
|
|
145
|
+
}
|
|
146
|
+
.m-account__label {
|
|
147
|
+
font-family: var(--font-body);
|
|
148
|
+
font-size: 0.9375rem;
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
color: var(--fg);
|
|
151
|
+
}
|
|
152
|
+
.m-account__hint {
|
|
153
|
+
font-size: 0.875rem;
|
|
154
|
+
color: var(--muted);
|
|
155
|
+
line-height: 1.5;
|
|
156
|
+
}
|
|
157
|
+
.m-account__error {
|
|
158
|
+
margin: 0;
|
|
159
|
+
font-size: 0.9rem;
|
|
160
|
+
font-weight: 600;
|
|
161
|
+
color: var(--fg);
|
|
162
|
+
line-height: 1.5;
|
|
163
|
+
}
|
|
164
|
+
.m-account__error::before {
|
|
165
|
+
content: '! ';
|
|
166
|
+
color: var(--gold);
|
|
167
|
+
}
|
|
168
|
+
.m-account__input {
|
|
169
|
+
font: inherit;
|
|
170
|
+
font-size: 1rem;
|
|
171
|
+
color: var(--fg);
|
|
172
|
+
background: var(--field-bg, var(--bg-surface));
|
|
173
|
+
border: var(--field-border, 1px solid var(--border));
|
|
174
|
+
border-radius: var(--field-radius, var(--radius-sm));
|
|
175
|
+
padding: 0.7rem 0.85rem;
|
|
176
|
+
width: 100%;
|
|
177
|
+
box-sizing: border-box;
|
|
178
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
179
|
+
}
|
|
180
|
+
.m-account__input--code {
|
|
181
|
+
max-width: 14rem;
|
|
182
|
+
font-family: var(--font-mono);
|
|
183
|
+
font-size: 1.35rem;
|
|
184
|
+
letter-spacing: 0.3em;
|
|
185
|
+
font-variant-numeric: tabular-nums;
|
|
186
|
+
}
|
|
187
|
+
.m-account__input:focus {
|
|
188
|
+
outline: none;
|
|
189
|
+
border-color: var(--gold);
|
|
190
|
+
box-shadow: 0 0 0 3px var(--gold-light);
|
|
191
|
+
}
|
|
192
|
+
.m-account__input[aria-invalid='true'] {
|
|
193
|
+
border-color: var(--fg);
|
|
194
|
+
border-width: 2px;
|
|
195
|
+
}
|
|
196
|
+
html[data-field='filled'] .m-account__input {
|
|
197
|
+
background: var(--bg-section);
|
|
198
|
+
border-color: transparent;
|
|
199
|
+
}
|
|
200
|
+
html[data-field='underline'] .m-account__input {
|
|
201
|
+
background: transparent;
|
|
202
|
+
border: none;
|
|
203
|
+
border-bottom: 1.5px solid var(--border);
|
|
204
|
+
border-radius: 0;
|
|
205
|
+
padding-inline: 0;
|
|
206
|
+
}
|
|
207
|
+
html[data-field='underline'] .m-account__input:focus {
|
|
208
|
+
border-bottom-color: var(--gold);
|
|
209
|
+
box-shadow: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* The terms box: React Aria's tick box (a real, visually hidden checkbox), drawn here. */
|
|
213
|
+
.m-account__agree {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
gap: 0.4rem;
|
|
217
|
+
}
|
|
218
|
+
.m-account__check {
|
|
219
|
+
display: inline-flex;
|
|
220
|
+
align-items: flex-start;
|
|
221
|
+
gap: 0.65rem;
|
|
222
|
+
line-height: 1.5;
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
}
|
|
225
|
+
.m-account__box {
|
|
226
|
+
flex: none;
|
|
227
|
+
display: grid;
|
|
228
|
+
place-items: center;
|
|
229
|
+
width: 1.25rem;
|
|
230
|
+
height: 1.25rem;
|
|
231
|
+
margin-top: 0.1rem;
|
|
232
|
+
border: 2px solid var(--fg);
|
|
233
|
+
border-radius: calc(var(--radius-sm) * 0.5);
|
|
234
|
+
background: var(--bg-surface);
|
|
235
|
+
box-sizing: border-box;
|
|
236
|
+
}
|
|
237
|
+
.m-account__box svg {
|
|
238
|
+
width: 0.9rem;
|
|
239
|
+
height: 0.9rem;
|
|
240
|
+
fill: none;
|
|
241
|
+
stroke: var(--on-brand);
|
|
242
|
+
stroke-width: 3;
|
|
243
|
+
stroke-linecap: round;
|
|
244
|
+
stroke-linejoin: round;
|
|
245
|
+
visibility: hidden;
|
|
246
|
+
}
|
|
247
|
+
.m-account__check[data-selected] .m-account__box {
|
|
248
|
+
background: var(--gold);
|
|
249
|
+
border-color: var(--gold);
|
|
250
|
+
}
|
|
251
|
+
.m-account__check[data-selected] .m-account__box svg {
|
|
252
|
+
visibility: visible;
|
|
253
|
+
}
|
|
254
|
+
.m-account__check[data-focus-visible] .m-account__box {
|
|
255
|
+
outline: 2px solid var(--gold);
|
|
256
|
+
outline-offset: 2px;
|
|
257
|
+
}
|
|
258
|
+
.m-account__check[data-invalid] .m-account__box {
|
|
259
|
+
border-width: 3px;
|
|
260
|
+
}
|
|
261
|
+
.m-account__links {
|
|
262
|
+
display: flex;
|
|
263
|
+
flex-wrap: wrap;
|
|
264
|
+
gap: 0.25rem 1rem;
|
|
265
|
+
margin: 0 0 0 1.9rem;
|
|
266
|
+
font-size: 0.9rem;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* Buttons: the main one filled in the site's accent; the others quieter. */
|
|
270
|
+
.m-account__row {
|
|
271
|
+
display: flex;
|
|
272
|
+
flex-wrap: wrap;
|
|
273
|
+
align-items: center;
|
|
274
|
+
gap: 0.75rem 1.25rem;
|
|
275
|
+
}
|
|
276
|
+
.m-account__go,
|
|
277
|
+
.m-account__plain,
|
|
278
|
+
.m-account__danger {
|
|
279
|
+
align-self: flex-start;
|
|
280
|
+
min-height: 44px;
|
|
281
|
+
padding: 0.6rem 1.25rem;
|
|
282
|
+
font: inherit;
|
|
283
|
+
font-family: var(--font-heading);
|
|
284
|
+
font-weight: 600;
|
|
285
|
+
border-radius: var(--radius-sm);
|
|
286
|
+
cursor: pointer;
|
|
287
|
+
box-sizing: border-box;
|
|
288
|
+
touch-action: manipulation;
|
|
289
|
+
}
|
|
290
|
+
.m-account__go {
|
|
291
|
+
border: 2px solid var(--gold);
|
|
292
|
+
background: var(--gold);
|
|
293
|
+
color: var(--on-brand);
|
|
294
|
+
}
|
|
295
|
+
.m-account__go[data-hovered] {
|
|
296
|
+
background: color-mix(in srgb, var(--gold) 85%, #000);
|
|
297
|
+
border-color: color-mix(in srgb, var(--gold) 85%, #000);
|
|
298
|
+
}
|
|
299
|
+
.m-account__plain {
|
|
300
|
+
border: 2px solid var(--fg);
|
|
301
|
+
background: transparent;
|
|
302
|
+
color: var(--fg);
|
|
303
|
+
}
|
|
304
|
+
.m-account__plain[data-hovered] {
|
|
305
|
+
border-color: var(--gold);
|
|
306
|
+
color: var(--gold);
|
|
307
|
+
}
|
|
308
|
+
.m-account__danger {
|
|
309
|
+
border: 2px solid var(--fg);
|
|
310
|
+
background: var(--fg);
|
|
311
|
+
color: var(--bg-surface);
|
|
312
|
+
}
|
|
313
|
+
.m-account__link {
|
|
314
|
+
padding: 0.25rem 0;
|
|
315
|
+
border: 0;
|
|
316
|
+
background: none;
|
|
317
|
+
color: var(--fg);
|
|
318
|
+
font: inherit;
|
|
319
|
+
text-decoration: underline;
|
|
320
|
+
text-underline-offset: 0.15em;
|
|
321
|
+
cursor: pointer;
|
|
322
|
+
}
|
|
323
|
+
.m-account__link--danger {
|
|
324
|
+
color: var(--muted);
|
|
325
|
+
}
|
|
326
|
+
.m-account__go[data-focus-visible],
|
|
327
|
+
.m-account__plain[data-focus-visible],
|
|
328
|
+
.m-account__danger[data-focus-visible],
|
|
329
|
+
.m-account__link[data-focus-visible] {
|
|
330
|
+
outline: 2px solid var(--gold);
|
|
331
|
+
outline-offset: 2px;
|
|
332
|
+
}
|
|
333
|
+
.m-account [data-disabled],
|
|
334
|
+
.m-account [data-pending] {
|
|
335
|
+
opacity: 0.55;
|
|
336
|
+
cursor: default;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.m-account__part {
|
|
340
|
+
padding-top: 1.25rem;
|
|
341
|
+
border-top: 1px solid var(--border);
|
|
342
|
+
}
|
|
343
|
+
section.m-account__part {
|
|
344
|
+
display: flex;
|
|
345
|
+
flex-direction: column;
|
|
346
|
+
gap: 0.85rem;
|
|
347
|
+
}
|
|
348
|
+
.m-account__delete {
|
|
349
|
+
padding: 1rem 1.1rem;
|
|
350
|
+
border: 1px solid var(--border);
|
|
351
|
+
border-radius: var(--radius-sm);
|
|
352
|
+
background: var(--bg-section);
|
|
353
|
+
}
|
|
354
|
+
.m-account__sr {
|
|
355
|
+
position: absolute;
|
|
356
|
+
width: 1px;
|
|
357
|
+
height: 1px;
|
|
358
|
+
margin: -1px;
|
|
359
|
+
padding: 0;
|
|
360
|
+
overflow: hidden;
|
|
361
|
+
clip: rect(0 0 0 0);
|
|
362
|
+
white-space: nowrap;
|
|
363
|
+
border: 0;
|
|
364
|
+
}
|
|
365
|
+
@media (prefers-reduced-motion: reduce) {
|
|
366
|
+
.m-account__input {
|
|
367
|
+
transition: none;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
</style>
|
|
@@ -1,136 +1,138 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* PostCard — a post preview for the news index and tag pages. Token-driven (radius,
|
|
4
|
-
* border, shadow, colours all from the theme), equal-height in a grid, with the
|
|
5
|
-
* whole card clickable via a stretched title link.
|
|
6
|
-
*/
|
|
7
|
-
interface Props {
|
|
8
|
-
href: string;
|
|
9
|
-
title: string;
|
|
10
|
-
date: Date | string;
|
|
11
|
-
summary?: string;
|
|
12
|
-
heroImage?: string;
|
|
13
|
-
/** Optional tag labels shown as a small eyebrow. */
|
|
14
|
-
tagLabels?: string[];
|
|
15
|
-
/** Open the link in a new tab (e.g. a post that's just an attached PDF). */
|
|
16
|
-
newTab?: boolean;
|
|
17
|
-
/** The call-to-action label (default "Read more"). */
|
|
18
|
-
moreLabel?: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
font-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
font-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* PostCard — a post preview for the news index and tag pages. Token-driven (radius,
|
|
4
|
+
* border, shadow, colours all from the theme), equal-height in a grid, with the
|
|
5
|
+
* whole card clickable via a stretched title link.
|
|
6
|
+
*/
|
|
7
|
+
interface Props {
|
|
8
|
+
href: string;
|
|
9
|
+
title: string;
|
|
10
|
+
date: Date | string;
|
|
11
|
+
summary?: string;
|
|
12
|
+
heroImage?: string;
|
|
13
|
+
/** Optional tag labels shown as a small eyebrow. */
|
|
14
|
+
tagLabels?: string[];
|
|
15
|
+
/** Open the link in a new tab (e.g. a post that's just an attached PDF). */
|
|
16
|
+
newTab?: boolean;
|
|
17
|
+
/** The call-to-action label (default "Read more"). */
|
|
18
|
+
moreLabel?: string;
|
|
19
|
+
/** Inline style, e.g. a planned grid's placement (lib/gridRows). */
|
|
20
|
+
style?: string;
|
|
21
|
+
}
|
|
22
|
+
const { href, title, date, summary, heroImage, tagLabels = [], newTab = false, moreLabel = 'Read more', style } = Astro.props;
|
|
23
|
+
const linkRel = newTab ? 'noopener' : undefined;
|
|
24
|
+
const linkTarget = newTab ? '_blank' : undefined;
|
|
25
|
+
const d = date instanceof Date ? date : new Date(date);
|
|
26
|
+
const iso = Number.isNaN(d.valueOf()) ? undefined : d.toISOString().slice(0, 10);
|
|
27
|
+
const display = Number.isNaN(d.valueOf())
|
|
28
|
+
? ''
|
|
29
|
+
: d.toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' });
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<article class="b-post-card" style={style}>
|
|
33
|
+
{heroImage && (
|
|
34
|
+
<a class="b-post-card__media" href={href} target={linkTarget} rel={linkRel} tabindex="-1" aria-hidden="true">
|
|
35
|
+
<img src={heroImage} alt="" loading="lazy" />
|
|
36
|
+
</a>
|
|
37
|
+
)}
|
|
38
|
+
<div class="b-post-card__body">
|
|
39
|
+
<div class="b-post-card__meta">
|
|
40
|
+
{tagLabels.length > 0 && <span class="b-post-card__eyebrow">{tagLabels[0]}</span>}
|
|
41
|
+
{display && <time datetime={iso}>{display}</time>}
|
|
42
|
+
</div>
|
|
43
|
+
<h3 class="b-post-card__title">
|
|
44
|
+
<a href={href} target={linkTarget} rel={linkRel}>{title}</a>
|
|
45
|
+
</h3>
|
|
46
|
+
{summary && <p class="b-post-card__summary">{summary}</p>}
|
|
47
|
+
<span class="b-post-card__more" aria-hidden="true">{moreLabel}</span>
|
|
48
|
+
</div>
|
|
49
|
+
</article>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.b-post-card {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
background: var(--bg-surface);
|
|
56
|
+
border: var(--card-border);
|
|
57
|
+
border-radius: var(--radius);
|
|
58
|
+
box-shadow: var(--shadow-sm);
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
position: relative;
|
|
61
|
+
transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
|
|
62
|
+
}
|
|
63
|
+
.b-post-card:hover {
|
|
64
|
+
transform: translateY(-2px);
|
|
65
|
+
box-shadow: var(--shadow-md);
|
|
66
|
+
border-color: var(--gold);
|
|
67
|
+
}
|
|
68
|
+
.b-post-card__media {
|
|
69
|
+
display: block;
|
|
70
|
+
position: relative;
|
|
71
|
+
aspect-ratio: 16 / 9;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
background: var(--bg-section);
|
|
74
|
+
}
|
|
75
|
+
/* Absolutely-positioned + object-fit:cover so ANY source ratio is cropped to a
|
|
76
|
+
uniform 16:9 tile — never stretched, never overflowing into the text. The
|
|
77
|
+
compound selector (and inset/size) also out-specifies the global
|
|
78
|
+
`img { height:auto }` in Base, which otherwise lets tall images blow the box. */
|
|
79
|
+
.b-post-card .b-post-card__media img {
|
|
80
|
+
position: absolute;
|
|
81
|
+
inset: 0;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
object-fit: cover;
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
.b-post-card__body {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: 0.5rem;
|
|
91
|
+
padding: 1.1rem 1.2rem 1.3rem;
|
|
92
|
+
flex: 1;
|
|
93
|
+
}
|
|
94
|
+
.b-post-card__meta {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-wrap: wrap;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 0.5rem 0.75rem;
|
|
99
|
+
}
|
|
100
|
+
.b-post-card__eyebrow {
|
|
101
|
+
font-family: var(--font-heading);
|
|
102
|
+
font-size: 0.7rem;
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
letter-spacing: 0.08em;
|
|
105
|
+
text-transform: uppercase;
|
|
106
|
+
color: var(--gold);
|
|
107
|
+
}
|
|
108
|
+
.b-post-card__title {
|
|
109
|
+
margin: 0;
|
|
110
|
+
}
|
|
111
|
+
/* Stretch the title link over the whole card so the card is clickable, while
|
|
112
|
+
the meta/summary stay selectable. */
|
|
113
|
+
.b-post-card__title a::after {
|
|
114
|
+
content: '';
|
|
115
|
+
position: absolute;
|
|
116
|
+
inset: 0;
|
|
117
|
+
}
|
|
118
|
+
.b-post-card__title a {
|
|
119
|
+
color: var(--fg);
|
|
120
|
+
}
|
|
121
|
+
.b-post-card:hover .b-post-card__title a {
|
|
122
|
+
color: var(--gold);
|
|
123
|
+
}
|
|
124
|
+
.b-post-card__summary {
|
|
125
|
+
margin: 0;
|
|
126
|
+
color: var(--muted);
|
|
127
|
+
font-size: 0.95rem;
|
|
128
|
+
line-height: 1.55;
|
|
129
|
+
}
|
|
130
|
+
.b-post-card__more {
|
|
131
|
+
margin-top: auto;
|
|
132
|
+
padding-top: 0.4rem;
|
|
133
|
+
font-family: var(--font-heading);
|
|
134
|
+
font-size: 0.85rem;
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
color: var(--gold);
|
|
137
|
+
}
|
|
138
|
+
</style>
|