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
|
@@ -1,219 +1,213 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* MediaCards — a Level-2 recipe: a grid of rich content cards with the IMAGE as a
|
|
4
|
-
* header on top (cover-cropped to a uniform ratio, like PostCard), then an optional
|
|
5
|
-
* icon badge, a title, a meta line (e.g. "Sundays 10:45 · Main hall"), a description, and
|
|
6
|
-
* an optional CTA link. The image-HEADER pattern (distinct from `tiles`, which puts
|
|
7
|
-
* the image BEHIND the text): use it for groups, team members, services or events —
|
|
8
|
-
* anywhere the photo and the copy both need to be fully legible. Whole card links
|
|
9
|
-
* when `href` is set. Token-driven, equal-height.
|
|
10
|
-
*/
|
|
11
|
-
import Icon from '../Icon.astro';
|
|
12
|
-
import {
|
|
13
|
-
import { isIconKey } from '../../lib/icons';
|
|
14
|
-
import Heading from '../blocks/Heading.astro';
|
|
15
|
-
|
|
16
|
-
import { inlineMarkdown, inlineMarkdownNoLinks } from '../../lib/inline-markdown';
|
|
17
|
-
interface Card {
|
|
18
|
-
image?: { src: string; alt?: string; focus?: string };
|
|
19
|
-
icon?: string;
|
|
20
|
-
title: string;
|
|
21
|
-
meta?: string;
|
|
22
|
-
text?: string;
|
|
23
|
-
href?: string;
|
|
24
|
-
linkLabel?: string;
|
|
25
|
-
}
|
|
26
|
-
interface Props {
|
|
27
|
-
title?: string;
|
|
28
|
-
intro?: string;
|
|
29
|
-
columns?: 2 | 3;
|
|
30
|
-
ratio?: '16/9' | '4/3' | '3/2' | '1/1' | '3/4';
|
|
31
|
-
cards?: Card[];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const {
|
|
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
|
-
|
|
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
|
-
.b-media-cards__media {
|
|
134
|
-
position:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
margin-top:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
.b-media-cards__title {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
font-size: 0.85rem;
|
|
215
|
-
font-weight: 600;
|
|
216
|
-
color: var(--gold);
|
|
217
|
-
overflow-wrap: anywhere;
|
|
218
|
-
}
|
|
219
|
-
</style>
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* MediaCards — a Level-2 recipe: a grid of rich content cards with the IMAGE as a
|
|
4
|
+
* header on top (cover-cropped to a uniform ratio, like PostCard), then an optional
|
|
5
|
+
* icon badge, a title, a meta line (e.g. "Sundays 10:45 · Main hall"), a description, and
|
|
6
|
+
* an optional CTA link. The image-HEADER pattern (distinct from `tiles`, which puts
|
|
7
|
+
* the image BEHIND the text): use it for groups, team members, services or events —
|
|
8
|
+
* anywhere the photo and the copy both need to be fully legible. Whole card links
|
|
9
|
+
* when `href` is set. Token-driven, equal-height.
|
|
10
|
+
*/
|
|
11
|
+
import Icon from '../Icon.astro';
|
|
12
|
+
import { planGrid } from '../../lib/gridRows';
|
|
13
|
+
import { isIconKey } from '../../lib/icons';
|
|
14
|
+
import Heading from '../blocks/Heading.astro';
|
|
15
|
+
|
|
16
|
+
import { inlineMarkdown, inlineMarkdownNoLinks } from '../../lib/inline-markdown';
|
|
17
|
+
interface Card {
|
|
18
|
+
image?: { src: string; alt?: string; focus?: string };
|
|
19
|
+
icon?: string;
|
|
20
|
+
title: string;
|
|
21
|
+
meta?: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
href?: string;
|
|
24
|
+
linkLabel?: string;
|
|
25
|
+
}
|
|
26
|
+
interface Props {
|
|
27
|
+
title?: string;
|
|
28
|
+
intro?: string;
|
|
29
|
+
columns?: 2 | 3;
|
|
30
|
+
ratio?: '16/9' | '4/3' | '3/2' | '1/1' | '3/4';
|
|
31
|
+
cards?: Card[];
|
|
32
|
+
/** How the ragged last row lays out (lib/gridRows). */
|
|
33
|
+
lastRow?: 'auto' | 'fill' | 'center';
|
|
34
|
+
}
|
|
35
|
+
const { title, intro, columns = 3, ratio = '16/9', cards = [], lastRow = 'auto' } = Astro.props;
|
|
36
|
+
// Rows planned per screen (lib/gridRows); `data-single` centres a lone card.
|
|
37
|
+
const plan = planGrid(cards.length, { columns, item: 'mediaCards', lastRow });
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
<section class="b-media-cards">
|
|
41
|
+
{(title || intro) && (
|
|
42
|
+
<div class="b-media-cards__head">
|
|
43
|
+
{title && <Heading text={title} level={2} />}
|
|
44
|
+
{intro && <p class="b-media-cards__intro" set:html={inlineMarkdown(intro)} />}
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
<div class="b-media-cards__grid ferst-rows" data-cols={plan.cols} data-single={cards.length === 1 ? 'true' : undefined} style={plan.gridStyle}>
|
|
48
|
+
{cards.map((card, i) => {
|
|
49
|
+
// Surface a mailto:/tel: as visible, copyable text — a plain mailto does
|
|
50
|
+
// nothing on a device with no mail app, so the address must be readable too.
|
|
51
|
+
const email = card.href?.startsWith('mailto:') ? card.href.slice(7).split('?')[0] : null;
|
|
52
|
+
const phone = card.href?.startsWith('tel:') ? card.href.slice(4) : null;
|
|
53
|
+
return (
|
|
54
|
+
<article class:list={['b-media-cards__card', 'ferst-tile', 'ferst-tile--sm', card.href && 'is-link']} style={plan.itemStyles[i]}>
|
|
55
|
+
{card.image && (
|
|
56
|
+
<div class="b-media-cards__media" data-ratio={ratio} style={`aspect-ratio: ${ratio.replace('/', ' / ')}`}>
|
|
57
|
+
<img src={card.image.src} alt={card.image.alt ?? ''} loading="lazy" style={card.image.focus ? `object-position: ${card.image.focus}` : undefined} />
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
<div class="b-media-cards__body">
|
|
61
|
+
{card.icon && isIconKey(card.icon) && (
|
|
62
|
+
<span class="b-media-cards__badge" aria-hidden="true"><Icon name={card.icon} size={20} /></span>
|
|
63
|
+
)}
|
|
64
|
+
<h3 class="b-media-cards__title">
|
|
65
|
+
{card.href ? <a href={card.href}>{card.title}</a> : card.title}
|
|
66
|
+
</h3>
|
|
67
|
+
{card.meta && <p class="b-media-cards__meta">{card.meta}</p>}
|
|
68
|
+
{card.text && <p class="b-media-cards__text" set:html={card.href ? inlineMarkdownNoLinks(card.text) : inlineMarkdown(card.text)} />}
|
|
69
|
+
{(email || phone) && (
|
|
70
|
+
<span class="b-media-cards__contact">{email ?? phone}</span>
|
|
71
|
+
)}
|
|
72
|
+
{card.href && !email && !phone && (
|
|
73
|
+
<span class="b-media-cards__cta" aria-hidden="true">{card.linkLabel ?? 'Learn more'} →</span>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
</article>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
|
|
82
|
+
<style>
|
|
83
|
+
.b-media-cards {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: 2rem;
|
|
87
|
+
width: 100%; /* the full content width, whatever its items hold (lib/gridRows) */
|
|
88
|
+
max-width: 72rem;
|
|
89
|
+
margin-inline: auto;
|
|
90
|
+
padding-inline: 1rem;
|
|
91
|
+
}
|
|
92
|
+
.b-media-cards__head {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 0.75rem;
|
|
96
|
+
}
|
|
97
|
+
.b-media-cards__intro {
|
|
98
|
+
margin: 0;
|
|
99
|
+
color: var(--muted);
|
|
100
|
+
font-size: 1.0625rem;
|
|
101
|
+
line-height: 1.6;
|
|
102
|
+
max-width: var(--max);
|
|
103
|
+
}
|
|
104
|
+
.b-media-cards__grid {
|
|
105
|
+
display: grid;
|
|
106
|
+
gap: 1.5rem;
|
|
107
|
+
}
|
|
108
|
+
/* A solitary card is a centred feature, not a full-width slab. */
|
|
109
|
+
.b-media-cards__grid[data-single] { max-width: 28rem; margin-inline: auto; }
|
|
110
|
+
/* Rows come from lib/gridRows (the global .ferst-rows rules): even rows where the
|
|
111
|
+
count allows by using fewer columns, else full rows and a tidied last row. */
|
|
112
|
+
.b-media-cards__card {
|
|
113
|
+
position: relative;
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
/* surface comes from .ferst-tile .ferst-tile--sm (bg/border/radius/shadow-sm) */
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
|
|
119
|
+
}
|
|
120
|
+
.b-media-cards__card.is-link:hover {
|
|
121
|
+
transform: translateY(-2px);
|
|
122
|
+
box-shadow: var(--shadow-md);
|
|
123
|
+
border-color: var(--gold);
|
|
124
|
+
}
|
|
125
|
+
/* Image header — cover-cropped to a uniform 16:9 so any source ratio fits (the
|
|
126
|
+
PostCard technique; also out-specifies the global img{height:auto}). */
|
|
127
|
+
.b-media-cards__media {
|
|
128
|
+
position: relative;
|
|
129
|
+
aspect-ratio: 16 / 9;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
background: var(--bg-section);
|
|
132
|
+
}
|
|
133
|
+
.b-media-cards .b-media-cards__media img {
|
|
134
|
+
position: absolute;
|
|
135
|
+
inset: 0;
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 100%;
|
|
138
|
+
object-fit: cover;
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
.b-media-cards__body {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
align-items: var(--content-items, stretch); /* follows the page / section alignment */
|
|
145
|
+
gap: 0.5rem;
|
|
146
|
+
padding: 1.1rem 1.2rem 1.3rem;
|
|
147
|
+
flex: 1;
|
|
148
|
+
}
|
|
149
|
+
/* Icon badge — a small brand chip; slightly lifted over the image edge when an
|
|
150
|
+
image is present (the negative margin only bites inside a card with a header). */
|
|
151
|
+
.b-media-cards__badge {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
width: 2.25rem;
|
|
156
|
+
height: 2.25rem;
|
|
157
|
+
border-radius: 999px;
|
|
158
|
+
background: var(--gold-light);
|
|
159
|
+
color: var(--gold);
|
|
160
|
+
margin-top: -2.3rem;
|
|
161
|
+
margin-bottom: 0.2rem;
|
|
162
|
+
border: 3px solid var(--bg-surface);
|
|
163
|
+
}
|
|
164
|
+
/* No image → the badge sits normally at the top of the body. */
|
|
165
|
+
.b-media-cards__card:not(:has(.b-media-cards__media)) .b-media-cards__badge {
|
|
166
|
+
margin-top: 0;
|
|
167
|
+
border: none;
|
|
168
|
+
}
|
|
169
|
+
.b-media-cards__title {
|
|
170
|
+
margin: 0;
|
|
171
|
+
font-size: 1.2rem;
|
|
172
|
+
color: var(--fg);
|
|
173
|
+
}
|
|
174
|
+
.b-media-cards__card.is-link:hover .b-media-cards__title a { color: var(--gold); }
|
|
175
|
+
.b-media-cards__title a { color: var(--fg); }
|
|
176
|
+
/* Stretch the title link over the whole card so it's clickable. */
|
|
177
|
+
.b-media-cards__title a::after { content: ''; position: absolute; inset: 0; }
|
|
178
|
+
.b-media-cards__meta {
|
|
179
|
+
margin: 0;
|
|
180
|
+
align-self: var(--content-self, flex-start); /* a pill keeps its width, follows the alignment */
|
|
181
|
+
padding: 0.2rem 0.6rem;
|
|
182
|
+
border-radius: 999px;
|
|
183
|
+
background: var(--bg-section);
|
|
184
|
+
color: var(--muted);
|
|
185
|
+
font-family: var(--font-heading);
|
|
186
|
+
font-size: 0.72rem;
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
letter-spacing: 0.03em;
|
|
189
|
+
}
|
|
190
|
+
.b-media-cards__text {
|
|
191
|
+
margin: 0;
|
|
192
|
+
color: var(--muted);
|
|
193
|
+
line-height: 1.6;
|
|
194
|
+
}
|
|
195
|
+
.b-media-cards__cta {
|
|
196
|
+
margin-top: auto;
|
|
197
|
+
padding-top: 0.5rem;
|
|
198
|
+
font-family: var(--font-heading);
|
|
199
|
+
font-size: 0.85rem;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
color: var(--gold);
|
|
202
|
+
}
|
|
203
|
+
/* A mailto/tel shown as visible, copyable text (below any description). */
|
|
204
|
+
.b-media-cards__contact {
|
|
205
|
+
margin-top: auto;
|
|
206
|
+
padding-top: 0.5rem;
|
|
207
|
+
font-family: var(--font-heading);
|
|
208
|
+
font-size: 0.85rem;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
color: var(--gold);
|
|
211
|
+
overflow-wrap: anywhere;
|
|
212
|
+
}
|
|
213
|
+
</style>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* MembersContent — a members' page from the Ferst Members module, written in the portal. The
|
|
4
|
+
* build renders only a placeholder (and the block's title, when it has one): what members read is
|
|
5
|
+
* never in the build. In the visitor's browser the block asks the site for the page
|
|
6
|
+
* (`/ferst-api/members/pages/<id>`, same-origin, the session cookie going with it), and the
|
|
7
|
+
* platform checks who is signed in. Then it shows the page, a sign-in prompt (401), "not included"
|
|
8
|
+
* (403) or "can't be shown" (anything else). On the author's own computer (`astro dev` /
|
|
9
|
+
* `astro preview`, no Pages Functions) it says sign-in works on the published site. lib/members
|
|
10
|
+
* holds the decisions.
|
|
11
|
+
*/
|
|
12
|
+
import Heading from '../blocks/Heading.astro';
|
|
13
|
+
import { MEMBERS_PAGE_TEXT, membersPageUrl } from '../../lib/members';
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
page: string;
|
|
17
|
+
title?: string;
|
|
18
|
+
}
|
|
19
|
+
const { page, title } = Astro.props;
|
|
20
|
+
const { align: blockAlign, headingAlign } = Astro.props as { align?: 'start' | 'center' | 'end'; headingAlign?: 'start' | 'center' | 'end' };
|
|
21
|
+
const headAlign = headingAlign ?? blockAlign;
|
|
22
|
+
const signIn = MEMBERS_PAGE_TEXT.signIn;
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<section class="b-members" data-members-page={membersPageUrl(page)} data-members-own-title={title ? undefined : ''} aria-busy="true">
|
|
26
|
+
<div class="b-members__head" data-recipe-head data-content-align={headAlign} hidden={!title}>
|
|
27
|
+
<Heading text={title ?? ''} level={2} />
|
|
28
|
+
</div>
|
|
29
|
+
<div class="b-members__skeleton" data-members-skeleton aria-hidden="true">
|
|
30
|
+
<span></span><span></span><span></span>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="b-members__body" data-members-body hidden></div>
|
|
33
|
+
<p class="b-members__notice" role="status" data-members-notice="sign-in" hidden>
|
|
34
|
+
{signIn.before} <a href="/account" data-members-sign-in>{signIn.link}</a> {signIn.after}
|
|
35
|
+
</p>
|
|
36
|
+
<p class="b-members__notice" role="status" data-members-notice="not-included" hidden>{MEMBERS_PAGE_TEXT.notIncluded}</p>
|
|
37
|
+
<p class="b-members__notice" role="status" data-members-notice="unavailable" hidden>{MEMBERS_PAGE_TEXT.unavailable}</p>
|
|
38
|
+
<p class="b-members__notice" role="status" data-members-notice="local" hidden>{MEMBERS_PAGE_TEXT.local}</p>
|
|
39
|
+
</section>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import { isLocalHost, membersPageView, readMembersAnswer, signInHref, type MembersAnswer } from '../../lib/members';
|
|
43
|
+
|
|
44
|
+
async function ask(url: string): Promise<MembersAnswer | null> {
|
|
45
|
+
try {
|
|
46
|
+
const res = await fetch(url, { credentials: 'same-origin', headers: { Accept: 'application/json' } });
|
|
47
|
+
return await readMembersAnswer(res);
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function setUp(block: HTMLElement) {
|
|
54
|
+
const url = block.dataset.membersPage;
|
|
55
|
+
if (!url) return;
|
|
56
|
+
const view = membersPageView(await ask(url), import.meta.env.DEV || isLocalHost(location.hostname));
|
|
57
|
+
block.querySelector<HTMLElement>('[data-members-skeleton]')?.remove();
|
|
58
|
+
block.removeAttribute('aria-busy');
|
|
59
|
+
if (view.kind === 'page') {
|
|
60
|
+
// The page's own title, unless the block gives its own.
|
|
61
|
+
const head = block.querySelector<HTMLElement>('.b-members__head');
|
|
62
|
+
if (head && block.dataset.membersOwnTitle !== undefined && view.title) {
|
|
63
|
+
const heading = head.querySelector<HTMLElement>('.b-heading');
|
|
64
|
+
if (heading) heading.textContent = view.title;
|
|
65
|
+
head.hidden = false;
|
|
66
|
+
}
|
|
67
|
+
const body = block.querySelector<HTMLElement>('[data-members-body]');
|
|
68
|
+
if (body) {
|
|
69
|
+
// The platform renders the page's Markdown and allows only plain tags (no scripts, no styles).
|
|
70
|
+
body.innerHTML = view.html;
|
|
71
|
+
body.hidden = false;
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (view.kind === 'sign-in') {
|
|
76
|
+
const link = block.querySelector<HTMLAnchorElement>('[data-members-sign-in]');
|
|
77
|
+
if (link) link.href = signInHref(location.pathname + location.search);
|
|
78
|
+
}
|
|
79
|
+
const notice = block.querySelector<HTMLElement>(`[data-members-notice="${view.kind}"]`);
|
|
80
|
+
if (notice) notice.hidden = false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
document.querySelectorAll<HTMLElement>('[data-members-page]').forEach((b) => { void setUp(b); });
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style>
|
|
87
|
+
.b-members {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: 1rem;
|
|
91
|
+
max-width: var(--max);
|
|
92
|
+
margin-inline: auto;
|
|
93
|
+
padding-inline: 1rem;
|
|
94
|
+
color: var(--fg);
|
|
95
|
+
}
|
|
96
|
+
.b-members__head[hidden],
|
|
97
|
+
.b-members__body[hidden],
|
|
98
|
+
.b-members__notice[hidden] {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* The placeholder while the page loads: three quiet bars, still under reduced motion. */
|
|
103
|
+
.b-members__skeleton {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
gap: 0.75rem;
|
|
107
|
+
}
|
|
108
|
+
.b-members__skeleton span {
|
|
109
|
+
display: block;
|
|
110
|
+
height: 1rem;
|
|
111
|
+
border-radius: var(--radius-sm);
|
|
112
|
+
background: var(--bg-section);
|
|
113
|
+
animation: b-members-pulse 1.6s ease-in-out infinite;
|
|
114
|
+
}
|
|
115
|
+
.b-members__skeleton span:nth-child(2) { width: 92%; }
|
|
116
|
+
.b-members__skeleton span:nth-child(3) { width: 64%; }
|
|
117
|
+
@keyframes b-members-pulse {
|
|
118
|
+
50% { opacity: 0.55; }
|
|
119
|
+
}
|
|
120
|
+
@media (prefers-reduced-motion: reduce) {
|
|
121
|
+
.b-members__skeleton span { animation: none; }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* The page itself: plain Markdown from the portal, read like a Prose block. */
|
|
125
|
+
.b-members__body :global(:is(p, ul, ol, blockquote, pre, table)) {
|
|
126
|
+
margin: 0 0 1rem;
|
|
127
|
+
line-height: 1.7;
|
|
128
|
+
}
|
|
129
|
+
.b-members__body :global(:is(ul, ol)) {
|
|
130
|
+
padding-inline-start: 1.4em;
|
|
131
|
+
}
|
|
132
|
+
.b-members__body :global(li + li) {
|
|
133
|
+
margin-top: 0.25rem;
|
|
134
|
+
}
|
|
135
|
+
.b-members__body :global(:is(h1, h2, h3, h4, h5, h6)) {
|
|
136
|
+
margin: 1.5rem 0 0.75rem;
|
|
137
|
+
line-height: 1.25;
|
|
138
|
+
color: var(--fg);
|
|
139
|
+
}
|
|
140
|
+
.b-members__body :global(a) {
|
|
141
|
+
color: var(--accent);
|
|
142
|
+
text-decoration: underline;
|
|
143
|
+
text-underline-offset: 0.15em;
|
|
144
|
+
}
|
|
145
|
+
.b-members__body :global(img) {
|
|
146
|
+
max-width: 100%;
|
|
147
|
+
height: auto;
|
|
148
|
+
border-radius: var(--radius-sm);
|
|
149
|
+
}
|
|
150
|
+
.b-members__body :global(blockquote) {
|
|
151
|
+
padding-inline-start: 1rem;
|
|
152
|
+
border-inline-start: 3px solid var(--border);
|
|
153
|
+
color: var(--muted);
|
|
154
|
+
}
|
|
155
|
+
.b-members__body > :global(:first-child) {
|
|
156
|
+
margin-top: 0;
|
|
157
|
+
}
|
|
158
|
+
.b-members__body > :global(:last-child) {
|
|
159
|
+
margin-bottom: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.b-members__notice {
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0.85rem 1rem;
|
|
165
|
+
border: 1px solid var(--border);
|
|
166
|
+
border-radius: var(--radius-sm);
|
|
167
|
+
background: var(--bg-section);
|
|
168
|
+
line-height: 1.5;
|
|
169
|
+
}
|
|
170
|
+
.b-members__notice a {
|
|
171
|
+
color: var(--accent);
|
|
172
|
+
font-weight: 600;
|
|
173
|
+
text-decoration: underline;
|
|
174
|
+
text-underline-offset: 0.15em;
|
|
175
|
+
}
|
|
176
|
+
</style>
|