@backgold/template-kit 0.1.0 → 0.1.1
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/dist/{chunk-KOB36GSF.js → chunk-RJAVFRC6.js} +9 -4
- package/dist/{constants-DvTNj4JI.d-Batjcj3Z.d.ts → constants-BAIo_Q5U.d-lQbj1e1-.d.ts} +11 -1
- package/dist/{content-api-CYeY0vU8.d.ts → content-api-Cox1-wz5.d.ts} +250 -3
- package/dist/contract/content-api-examples.d.ts +17 -3
- package/dist/contract/content-api-examples.js +146 -3
- package/dist/contract/content-api.d.ts +2 -2
- package/dist/contract/content-api.js +1 -1
- package/dist/contract/site-templates.d.ts +4 -3
- package/dist/contract/site-templates.js +1 -1
- package/package.json +5 -5
- package/src/components/chrome/Brand.astro +23 -16
- package/src/components/sections/About/credentials.ts +0 -10
- package/src/components/sections/About/index.astro +6 -3
- package/src/components/sections/About/left.astro +6 -3
- package/src/components/sections/About/letter.astro +6 -3
- package/src/components/sections/About/portrait.astro +2 -2
- package/src/components/sections/ContentPost/lesson.ts +14 -7
- package/src/components/sections/ContentPost/prose.astro +80 -0
- package/src/components/sections/Hero/cover.astro +9 -3
- package/src/components/sections/Hero/donate.astro +3 -3
- package/src/components/sections/Hero/index.astro +2 -2
- package/src/components/sections/Hero/overlap.astro +3 -3
- package/src/components/sections/Hero/split.astro +9 -6
- package/src/components/sections/Hero/statement.astro +3 -3
- package/src/components/sections/Hero/video.astro +3 -3
- package/src/components/sections/VoterTools/Lookup.astro +43 -0
- package/src/components/sections/VoterTools/dates.astro +9 -5
- package/src/components/sections/VoterTools/index.astro +12 -9
- package/src/components/sections/VoterTools/polling.astro +9 -6
- package/src/components/sections/VoterTools/voter-tools.ts +5 -4
- package/src/components/sections/index.ts +3 -0
- package/src/components/sections/modules/ModuleFrame.astro +4 -2
- package/src/components/store/CollectionPage.astro +40 -0
- package/src/components/store/ProductCard.astro +32 -0
- package/src/components/store/ProductGrid.astro +16 -0
- package/src/components/store/ProductPage.astro +146 -0
- package/src/components/store/StorePage.astro +137 -0
- package/src/components/store/StoreScript.astro +572 -0
- package/src/components/volunteer/props.ts +1 -1
- package/src/index.js +0 -1
- package/src/layouts/Site.astro +19 -3
- package/src/lib/chrome.ts +6 -4
- package/src/lib/donate-frame.ts +44 -4
- package/src/lib/live.ts +6 -5
- package/src/lib/section.ts +11 -0
- package/src/lib/shifts.ts +2 -1
- package/src/lib/store.ts +521 -0
- package/src/routes/catch-all.astro +168 -19
- package/src/styles/site.css +71 -0
- package/src/styles/store.css +634 -0
- package/src/template.ts +1 -1
- package/src/routes/volunteer.astro +0 -37
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
// A page that draws a Donate frame (a section or an area item of type Donate)
|
|
32
32
|
// names the donate query names its frame copies (READS_QUERY_HEADER,
|
|
33
33
|
// lib/donate-frame.ts), so the edge cache never answers `?amount=25` with
|
|
34
|
-
// the bare page's copy, and a request that carries one is never stored.
|
|
34
|
+
// the bare page's copy, and a request that carries one is never stored. A
|
|
35
|
+
// page that draws a form frame names `pick`, the choice the form opens on,
|
|
36
|
+
// the same way.
|
|
35
37
|
//
|
|
36
38
|
// `/events/<type>` is the events page with its Agenda and Calendar sections
|
|
37
39
|
// narrowed to that type (the Agenda's rows read from the Content API's `GET
|
|
@@ -45,6 +47,25 @@
|
|
|
45
47
|
// upcoming event. `/events.ics` is every upcoming event as one calendar file
|
|
46
48
|
// and `/events/<slug>.ics` one event's (src/lib/events.ts).
|
|
47
49
|
//
|
|
50
|
+
// The store (src/lib/store.ts, board 06 of the store design) is answered
|
|
51
|
+
// from the Content API's catalog reads when resolveRoute finds nothing at
|
|
52
|
+
// the address: `/store/<slug>` is a listing's page (GET /products/<slug>),
|
|
53
|
+
// `/store/departments/<slug>` a department's shelf (its `?attr=` filters
|
|
54
|
+
// passed to GET /products, its stored copy never answering a filtered
|
|
55
|
+
// address, which is never stored) and `/collections/<slug>`
|
|
56
|
+
// a collection's page (GET /collections/<slug>; the api's /types leaves the
|
|
57
|
+
// `collection` type out, so resolveRoute never answers it as an entry).
|
|
58
|
+
// `/store` is the shop (GET /products) whenever the organization has a
|
|
59
|
+
// published listing: a published page at /store becomes the shop's opening
|
|
60
|
+
// (its sections above the grid, a Store section among them left out), and
|
|
61
|
+
// with no listing that page is drawn as it is. A slug the api has no answer
|
|
62
|
+
// for, and every store address on an api older than the catalog, is a 404.
|
|
63
|
+
// Each store page carries the header's Cart link and the store script
|
|
64
|
+
// (components/store/StoreScript.astro); a listing's page also carries its
|
|
65
|
+
// island. Their areas are the page's at /store (else those of a page that
|
|
66
|
+
// holds the store, GET /areas?holds=store), the listing's and the
|
|
67
|
+
// collection's own; a Sidebar item draws under the page, full width.
|
|
68
|
+
//
|
|
48
69
|
// A lesson, `/<courses base>/<course>/<lesson>`, is the video read through
|
|
49
70
|
// its course (resolveRoute's `lesson`): drawn by the template's `course:lesson`
|
|
50
71
|
// entry layout (lessonLayoutFor; the kit's Lesson player when the template
|
|
@@ -71,14 +92,21 @@ import EntryCard from '../components/EntryCard.astro'
|
|
|
71
92
|
import EventPage from '../components/EventPage.astro'
|
|
72
93
|
import NotFound from '../components/NotFound.astro'
|
|
73
94
|
import PageSections from '../components/PageSections.astro'
|
|
74
|
-
import { entryLayoutFor, lessonLayoutFor, listLayoutFor } from '../components/entries'
|
|
95
|
+
import { entryLayoutFor, lessonLayoutFor, listLayoutFor, volunteerLayoutFor } from '../components/entries'
|
|
75
96
|
import type { ListLayoutProps } from '../components/entries/props'
|
|
76
97
|
import { basePath, filterOf, listName, searchNews, searchQuery } from '../lib/entries'
|
|
77
98
|
import { EVENTS_CALENDAR_PATH, MONTH_PARAM, calendarSlugOf, drawsCalendar, eventCalendar, eventPage, eventsCalendar, typedEventsPage } from '../lib/events'
|
|
78
99
|
import { entryCard, leadsWithHero } from '../lib/section'
|
|
79
|
-
import { DONATE_READS_QUERY, carriesDonateQuery, drawsDonateFrame } from '../lib/donate-frame'
|
|
100
|
+
import { DONATE_READS_QUERY, FORM_READS_QUERY, carriesDonateQuery, carriesPickQuery, drawsDonateFrame, drawsFormFrame } from '../lib/donate-frame'
|
|
101
|
+
import { VOLUNTEER_PATH, openShifts, volunteerAreas } from '../lib/shifts'
|
|
80
102
|
import { markReading } from '../lib/reading'
|
|
81
103
|
import { COURSE_TYPE_KEY, lessonSignInTitle } from '../lib/academy'
|
|
104
|
+
import { FILTER_PARAM, checkoutFor, collectionPage, departmentOf, filteredPath, productJsonLd, productPage, storeFiltersOf, storeRouteOf, storefront, type Checkout, type StoreFilters } from '../lib/store'
|
|
105
|
+
import StorePage from '../components/store/StorePage.astro'
|
|
106
|
+
import ProductPage from '../components/store/ProductPage.astro'
|
|
107
|
+
import CollectionPage from '../components/store/CollectionPage.astro'
|
|
108
|
+
import StoreScript from '../components/store/StoreScript.astro'
|
|
109
|
+
import type { CollectionDetail, PageResponse, ProductDepartment, ProductDetail, ProductsResponse } from '@backgold/content'
|
|
82
110
|
import template from 'virtual:backgold-template'
|
|
83
111
|
|
|
84
112
|
const { sections } = template
|
|
@@ -115,12 +143,66 @@ if (calendarSlug !== null) {
|
|
|
115
143
|
}
|
|
116
144
|
// The URL, not just the path: a list's `?cursor=` asks for a later page.
|
|
117
145
|
let resolved: Resolved = await resolveRoute(client, Astro.url, visitorReads)
|
|
118
|
-
|
|
146
|
+
// The store's pages (above): what the address is, and what the api answered for it.
|
|
147
|
+
type StoreView =
|
|
148
|
+
| { kind: 'store'; shop: ProductsResponse; department: ProductDepartment | null; intro: PageResponse | null; cursor: string | null; filters: StoreFilters }
|
|
149
|
+
| { kind: 'product'; product: ProductDetail; areas: Areas }
|
|
150
|
+
| { kind: 'collection'; collection: CollectionDetail; areas: Areas }
|
|
151
|
+
const storeRoute = storeRouteOf(pathname)
|
|
152
|
+
let store: StoreView | null = null
|
|
153
|
+
if (storeRoute?.kind === 'store' && (resolved.kind === 'not_found' || (resolved.kind === 'page' && storeRoute.department === null))) {
|
|
154
|
+
const cursor = Astro.url.searchParams.get('cursor') || null
|
|
155
|
+
// Only a department's page is filtered: the shop's root has no facets.
|
|
156
|
+
const filters = storeRoute.department === null ? [] : storeFiltersOf(Astro.url.searchParams)
|
|
157
|
+
const read = await storefront(client, { department: storeRoute.department, cursor, filters })
|
|
158
|
+
const shop = read?.shop ?? null
|
|
159
|
+
const department = shop ? departmentOf(shop.departments, storeRoute.department) : null
|
|
160
|
+
const open = shop !== null && (storeRoute.department === null ? shop.products.length > 0 || cursor !== null : department !== null)
|
|
161
|
+
if (open) store = { kind: 'store', shop: shop!, department, intro: resolved.kind === 'page' ? resolved.page : null, cursor, filters: read!.filters }
|
|
162
|
+
} else if (storeRoute?.kind === 'product' && resolved.kind === 'not_found') {
|
|
163
|
+
const found = await productPage(client, storeRoute.slug)
|
|
164
|
+
if (found) store = { kind: 'product', product: found.product, areas: found.areas }
|
|
165
|
+
} else if (storeRoute?.kind === 'collection' && resolved.kind === 'not_found') {
|
|
166
|
+
const found = await collectionPage(client, storeRoute.slug)
|
|
167
|
+
if (found) store = { kind: 'collection', collection: found.collection, areas: found.areas }
|
|
168
|
+
}
|
|
169
|
+
/** Where the store's cart checks out: read off the listings the page shows. */
|
|
170
|
+
const checkout: Checkout | null =
|
|
171
|
+
store?.kind === 'store'
|
|
172
|
+
? checkoutFor(store.shop.products)
|
|
173
|
+
: store?.kind === 'product'
|
|
174
|
+
? checkoutFor([store.product, ...store.product.related])
|
|
175
|
+
: store?.kind === 'collection'
|
|
176
|
+
? checkoutFor(store.collection.products)
|
|
177
|
+
: null
|
|
178
|
+
/** A page of the shop past the first, and the next one's address. */
|
|
179
|
+
const storePager =
|
|
180
|
+
store?.kind === 'store'
|
|
181
|
+
? {
|
|
182
|
+
more: store.shop.next_cursor ? filteredPath(pathname.replace(/\/+$/, ''), store.filters, store.shop.next_cursor) : null,
|
|
183
|
+
first: store.cursor ? filteredPath(pathname.replace(/\/+$/, ''), store.filters) : null,
|
|
184
|
+
}
|
|
185
|
+
: { more: null, first: null }
|
|
186
|
+
const storeAreas: Areas | null =
|
|
187
|
+
store?.kind === 'product'
|
|
188
|
+
? store.areas
|
|
189
|
+
: store?.kind === 'collection'
|
|
190
|
+
? store.areas
|
|
191
|
+
: store?.kind === 'store'
|
|
192
|
+
? (store.intro?.areas ?? (await client.areas({ holds: ['store'] }).then((a) => a.areas, () => null)))
|
|
193
|
+
: null
|
|
194
|
+
|
|
195
|
+
const typed = resolved.kind === 'not_found' && !store ? await typedEventsPage(client, Astro.request, pathname) : null
|
|
119
196
|
if (typed) {
|
|
120
197
|
resolved = { kind: 'page', page: typed.page }
|
|
121
198
|
drawnInstead(resolved)
|
|
122
199
|
}
|
|
123
|
-
const event = resolved.kind === 'not_found' ? await eventPage(client, pathname) : null
|
|
200
|
+
const event = resolved.kind === 'not_found' && !store ? await eventPage(client, pathname) : null
|
|
201
|
+
// `/volunteer` with no page of the site's own at that address is the kit's
|
|
202
|
+
// open-shifts list (lib/shifts.ts); a published Volunteer page there, the
|
|
203
|
+
// candidate starter's among them, is the page.
|
|
204
|
+
const volunteerList = resolved.kind === 'not_found' && !event && pathname === VOLUNTEER_PATH
|
|
205
|
+
const shifts = volunteerList ? await openShifts(client) : null
|
|
124
206
|
const rawQuery = Astro.url.searchParams.get('q')
|
|
125
207
|
const calendar = Astro.url.searchParams.has(MONTH_PARAM) || (resolved.kind === 'page' && resolved.page.sections.some(drawsCalendar))
|
|
126
208
|
if (rawQuery !== null || calendar) Astro.response.headers.set('Cache-Control', 'no-store')
|
|
@@ -130,7 +212,7 @@ if (resolved.kind === 'feed') {
|
|
|
130
212
|
headers: { 'Content-Type': 'application/atom+xml; charset=utf-8' },
|
|
131
213
|
})
|
|
132
214
|
}
|
|
133
|
-
if (resolved.kind === 'not_found' && !event) Astro.response.status = 404
|
|
215
|
+
if (resolved.kind === 'not_found' && !event && !volunteerList && !store) Astro.response.status = 404
|
|
134
216
|
|
|
135
217
|
let head: { title?: string; description?: string; image?: string; canonicalPath: string; noindex?: boolean; jsonLd?: object[] }
|
|
136
218
|
switch (resolved.kind) {
|
|
@@ -193,24 +275,79 @@ switch (resolved.kind) {
|
|
|
193
275
|
default:
|
|
194
276
|
head = event
|
|
195
277
|
? { title: `${event.event.title} · ${siteName}`, image: safeSrc(event.event.image_url) ?? undefined, canonicalPath: pathname }
|
|
196
|
-
:
|
|
278
|
+
: volunteerList
|
|
279
|
+
? { title: `Volunteer · ${siteName}`, description: `Open volunteer shifts with ${siteName}.`, canonicalPath: VOLUNTEER_PATH }
|
|
280
|
+
: { title: `Page not found · ${siteName}`, canonicalPath: pathname, noindex: true }
|
|
281
|
+
}
|
|
282
|
+
if (store?.kind === 'store') {
|
|
283
|
+
const intro = store.intro
|
|
284
|
+
const title = store.department ? store.department.label : (intro?.page.meta.title ?? intro?.page.title ?? 'Store')
|
|
285
|
+
head = {
|
|
286
|
+
title: `${title} · ${siteName}`,
|
|
287
|
+
description: intro?.page.meta.description ?? `Everything in the ${siteName} store.`,
|
|
288
|
+
image: safeSrc(intro?.page.meta.image_url) ?? safeSrc(store.shop.products[0]?.photos[0]?.url) ?? undefined,
|
|
289
|
+
canonicalPath: pathname.replace(/\/+$/, '') || '/',
|
|
290
|
+
...(intro ? { jsonLd: jsonLdFor({ site, siteUrl, kind: 'page', page: intro.page }) } : {}),
|
|
291
|
+
}
|
|
292
|
+
} else if (store?.kind === 'product') {
|
|
293
|
+
const { product } = store
|
|
294
|
+
head = {
|
|
295
|
+
title: `${product.seo.title} · ${siteName}`,
|
|
296
|
+
description: product.seo.description ?? undefined,
|
|
297
|
+
image: safeSrc(product.seo.image_url) ?? undefined,
|
|
298
|
+
canonicalPath: pathname,
|
|
299
|
+
jsonLd: [productJsonLd(product, siteUrl)],
|
|
300
|
+
}
|
|
301
|
+
} else if (store?.kind === 'collection') {
|
|
302
|
+
const { collection } = store
|
|
303
|
+
head = {
|
|
304
|
+
title: `${collection.title} · ${siteName}`,
|
|
305
|
+
description: collection.intro ?? undefined,
|
|
306
|
+
image: safeSrc(collection.cover?.url) ?? undefined,
|
|
307
|
+
canonicalPath: pathname,
|
|
308
|
+
}
|
|
197
309
|
}
|
|
198
310
|
const menuPage: MenuPage | null =
|
|
199
|
-
|
|
200
|
-
|
|
311
|
+
store?.kind === 'store' && store.intro
|
|
312
|
+
? { id: store.intro.page.id, takes_donations: store.intro.page.takes_donations }
|
|
313
|
+
: store
|
|
314
|
+
? null
|
|
315
|
+
: resolved.kind === 'page'
|
|
316
|
+
? { id: resolved.page.page.id, takes_donations: resolved.page.page.takes_donations }
|
|
317
|
+
: null
|
|
318
|
+
const areas: Areas | null = store ? storeAreas :
|
|
201
319
|
resolved.kind === 'page'
|
|
202
320
|
? resolved.page.areas
|
|
203
321
|
: resolved.kind === 'entry' || resolved.kind === 'index' || resolved.kind === 'term' || resolved.kind === 'lesson'
|
|
204
322
|
? resolved.areas
|
|
205
|
-
:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
323
|
+
: volunteerList
|
|
324
|
+
? await volunteerAreas(client)
|
|
325
|
+
: event?.areas ?? null
|
|
326
|
+
{
|
|
327
|
+
const pageSections = resolved.kind === 'page' ? resolved.page.sections : []
|
|
328
|
+
// A department's page reads its filters (`?attr=`), a name the edge
|
|
329
|
+
// cache's key leaves out: its stored copy is never served to a filtered
|
|
330
|
+
// address, and a filtered page is never stored.
|
|
331
|
+
const filtersRead = store?.kind === 'store' && store.department !== null
|
|
332
|
+
const reads = [
|
|
333
|
+
...(drawsDonateFrame(pageSections, areas) ? [DONATE_READS_QUERY] : []),
|
|
334
|
+
...(drawsFormFrame(pageSections, areas) ? [FORM_READS_QUERY] : []),
|
|
335
|
+
...(filtersRead ? [FILTER_PARAM] : []),
|
|
336
|
+
]
|
|
337
|
+
if (reads.length > 0) {
|
|
338
|
+
Astro.response.headers.set(READS_QUERY_HEADER, reads.join(','))
|
|
339
|
+
const carries =
|
|
340
|
+
(drawsDonateFrame(pageSections, areas) && carriesDonateQuery(Astro.url.searchParams)) ||
|
|
341
|
+
(drawsFormFrame(pageSections, areas) && carriesPickQuery(Astro.url.searchParams)) ||
|
|
342
|
+
(filtersRead && Astro.url.searchParams.has(FILTER_PARAM))
|
|
343
|
+
if (carries) Astro.response.headers.set('Cache-Control', 'no-store')
|
|
344
|
+
}
|
|
209
345
|
}
|
|
210
346
|
// The sections in an entry's areas leave out the entry being read (lib/reading.ts).
|
|
211
347
|
if (resolved.kind === 'entry') markReading(Astro.locals, resolved.entry.id)
|
|
212
348
|
if (resolved.kind === 'lesson') markReading(Astro.locals, resolved.lesson.lesson.id)
|
|
213
|
-
const sidebar = resolved.kind !== 'author' && resolved.kind !== 'not_found' && areaEntriesOf(areas, 'sidebar').length > 0
|
|
349
|
+
const sidebar = !store && resolved.kind !== 'author' && resolved.kind !== 'not_found' && areaEntriesOf(areas, 'sidebar').length > 0
|
|
350
|
+
const storeMore = store !== null && areaEntriesOf(areas, 'sidebar').length > 0
|
|
214
351
|
const heroOverSplit = sidebar && resolved.kind === 'page' && leadsWithHero(resolved.page.sections)
|
|
215
352
|
const eventMore = event !== null && areaEntriesOf(event.areas, 'sidebar').length > 0
|
|
216
353
|
|
|
@@ -243,6 +380,7 @@ if (resolved.kind === 'index' || resolved.kind === 'term') {
|
|
|
243
380
|
const ListLayout = list?.Layout ?? null
|
|
244
381
|
const EntryLayout = resolved.kind === 'entry' ? entryLayoutFor(template, resolved.entry.type) : null
|
|
245
382
|
const LessonLayout = resolved.kind === 'lesson' ? lessonLayoutFor(template) : null
|
|
383
|
+
const VolunteerListLayout = volunteerList ? volunteerLayoutFor(template, 'list') : null
|
|
246
384
|
/** What the header's Sign in names to the portal's door: a lesson, or a course's title on the course's page. */
|
|
247
385
|
const signInTitle =
|
|
248
386
|
resolved.kind === 'lesson'
|
|
@@ -253,8 +391,13 @@ const signInTitle =
|
|
|
253
391
|
const avatar = resolved.kind === 'author' ? safeSrc(resolved.author.avatar_url) : null
|
|
254
392
|
const authorLink = resolved.kind === 'author' ? safeHref(resolved.author.link_url) : null
|
|
255
393
|
---
|
|
256
|
-
<Site {...head} template={template} page={menuPage} areas={areas} signInTitle={signInTitle}>
|
|
257
|
-
{
|
|
394
|
+
<Site {...head} template={template} page={menuPage} areas={areas} signInTitle={signInTitle} cart={store ? checkout : null}>
|
|
395
|
+
{store?.kind === 'store' && <StorePage template={template} siteName={siteName} shop={store.shop} department={store.department} intro={store.intro} pager={storePager} filters={store.filters} />}
|
|
396
|
+
{store?.kind === 'product' && <ProductPage product={store.product} siteName={siteName} />}
|
|
397
|
+
{store?.kind === 'collection' && <CollectionPage collection={store.collection} />}
|
|
398
|
+
{storeMore && <Area name="sidebar" areas={areas} components={sections} class="store-more" />}
|
|
399
|
+
{store && <StoreScript />}
|
|
400
|
+
{!store && resolved.kind === 'author' && (
|
|
258
401
|
<div class="listing">
|
|
259
402
|
<header class="page-header author">
|
|
260
403
|
{avatar && <img class="author-avatar" src={avatar} alt="" />}
|
|
@@ -268,11 +411,17 @@ const authorLink = resolved.kind === 'author' ? safeHref(resolved.author.link_ur
|
|
|
268
411
|
</div>
|
|
269
412
|
)}
|
|
270
413
|
|
|
271
|
-
{resolved.kind === 'not_found' && (event ? <EventLayout event={event.event} /> : <NotFoundLayout />)}
|
|
414
|
+
{!store && resolved.kind === 'not_found' && !volunteerList && (event ? <EventLayout event={event.event} /> : <NotFoundLayout />)}
|
|
415
|
+
{VolunteerListLayout && (
|
|
416
|
+
<div class:list={['layout', sidebar && 'layout-split']}>
|
|
417
|
+
<div class="layout-main"><VolunteerListLayout shifts={shifts ?? []} siteName={siteName} /></div>
|
|
418
|
+
{sidebar && <div class="layout-rail"><Area name="sidebar" areas={areas} components={sections} class="rail" /></div>}
|
|
419
|
+
</div>
|
|
420
|
+
)}
|
|
272
421
|
{eventMore && event && <Area name="sidebar" areas={event.areas} components={sections} class="event-more" />}
|
|
273
422
|
|
|
274
|
-
{heroOverSplit && resolved.kind === 'page' && <PageSections template={template} page={resolved.page} siteName={siteName} only="lead" />}
|
|
275
|
-
{resolved.kind !== 'author' && resolved.kind !== 'not_found' && (
|
|
423
|
+
{!store && heroOverSplit && resolved.kind === 'page' && <PageSections template={template} page={resolved.page} siteName={siteName} only="lead" />}
|
|
424
|
+
{!store && resolved.kind !== 'author' && resolved.kind !== 'not_found' && (
|
|
276
425
|
<div class:list={['layout', sidebar && 'layout-split']}>
|
|
277
426
|
<div class="layout-main">
|
|
278
427
|
{resolved.kind === 'page' && <PageSections template={template} page={resolved.page} siteName={siteName} only={heroOverSplit ? 'rest' : undefined} />}
|
package/src/styles/site.css
CHANGED
|
@@ -323,6 +323,23 @@ main:focus {
|
|
|
323
323
|
max-width: 100%;
|
|
324
324
|
width: auto;
|
|
325
325
|
}
|
|
326
|
+
/*
|
|
327
|
+
The logo with the name beside it (`showName`): the logo keeps its size, up
|
|
328
|
+
to half the screen's width for a wide one, and the wordmark beside it is
|
|
329
|
+
what gives way when the bar is short of room.
|
|
330
|
+
*/
|
|
331
|
+
.brand-named .brand-logo {
|
|
332
|
+
flex: 0 0 auto;
|
|
333
|
+
max-width: min(14rem, 50vw);
|
|
334
|
+
}
|
|
335
|
+
.brand-named .brand-words {
|
|
336
|
+
overflow: hidden;
|
|
337
|
+
}
|
|
338
|
+
/* The menu's labels stay one line each beside it, so the wordmark is what shortens. */
|
|
339
|
+
.site-header:has(.brand-named) .header-bar-menu > ul > li > :is(a, span),
|
|
340
|
+
.site-header:has(.brand-named) .header-bar-menu summary {
|
|
341
|
+
white-space: nowrap;
|
|
342
|
+
}
|
|
326
343
|
.brand-words {
|
|
327
344
|
display: grid;
|
|
328
345
|
min-width: 0;
|
|
@@ -1119,6 +1136,26 @@ main:focus {
|
|
|
1119
1136
|
}
|
|
1120
1137
|
}
|
|
1121
1138
|
|
|
1139
|
+
/*
|
|
1140
|
+
A picture shown whole: a Hero's or an About's photo treatment 'badge' or
|
|
1141
|
+
'plain' (lib/section.ts photoStyleOf), on the picture a layout draws in a
|
|
1142
|
+
frame of fixed shape. The frame keeps its shape and the picture sits inside
|
|
1143
|
+
it, centred, uncropped: on the frame's surface with a line around it
|
|
1144
|
+
('badge'), or on nothing ('plain'). The section prefix outranks a layout's
|
|
1145
|
+
own scoped `object-fit: cover`.
|
|
1146
|
+
*/
|
|
1147
|
+
.bg-section img.photo-badge,
|
|
1148
|
+
.bg-section img.photo-plain {
|
|
1149
|
+
object-fit: contain;
|
|
1150
|
+
object-position: center;
|
|
1151
|
+
}
|
|
1152
|
+
.bg-section img.photo-badge {
|
|
1153
|
+
box-sizing: border-box;
|
|
1154
|
+
padding: 1rem;
|
|
1155
|
+
border: 1px solid var(--line);
|
|
1156
|
+
background: var(--surface);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1122
1159
|
/* About */
|
|
1123
1160
|
.about-photo {
|
|
1124
1161
|
display: block;
|
|
@@ -1393,6 +1430,40 @@ details summary {
|
|
|
1393
1430
|
background: var(--page);
|
|
1394
1431
|
}
|
|
1395
1432
|
|
|
1433
|
+
/*
|
|
1434
|
+
Contact your legislators is no frame: BackGold's script draws it in the page,
|
|
1435
|
+
in a shadow root on `.bg-embed-mount`, and takes its look from the
|
|
1436
|
+
`--bg-adv-*` variables, which cross into it. They are the colors of the
|
|
1437
|
+
band it sits on, as the frames wear them (ModuleFrame): the band's ink and
|
|
1438
|
+
gray, fields on its surface with the strong line for an edge, the quieter
|
|
1439
|
+
solid button for its calls, the display face for its headings. On a card
|
|
1440
|
+
(`.module-card`) they are the panel band's, the card's own ground. A
|
|
1441
|
+
template with a look of its own for the frames sets these again in its
|
|
1442
|
+
src/styles/template.css.
|
|
1443
|
+
*/
|
|
1444
|
+
.module .bg-embed-mount {
|
|
1445
|
+
--bg-adv-text: var(--ink);
|
|
1446
|
+
--bg-adv-muted: var(--muted);
|
|
1447
|
+
--bg-adv-link: var(--link);
|
|
1448
|
+
--bg-adv-accent: var(--button-2);
|
|
1449
|
+
--bg-adv-accent-ink: var(--button-2-ink);
|
|
1450
|
+
--bg-adv-card: var(--surface);
|
|
1451
|
+
--bg-adv-input-bg: var(--surface);
|
|
1452
|
+
--bg-adv-border: var(--line-strong);
|
|
1453
|
+
--bg-adv-radius: var(--radius);
|
|
1454
|
+
--bg-adv-font: var(--font);
|
|
1455
|
+
--bg-adv-heading-font: var(--font-display);
|
|
1456
|
+
}
|
|
1457
|
+
.module-card .bg-embed-mount {
|
|
1458
|
+
--ink: var(--band-panel-ink);
|
|
1459
|
+
--muted: var(--band-panel-muted);
|
|
1460
|
+
--link: var(--band-panel-link);
|
|
1461
|
+
--button-2: var(--band-panel-button-2);
|
|
1462
|
+
--button-2-ink: var(--band-panel-button-2-ink);
|
|
1463
|
+
--surface: var(--band-panel-surface);
|
|
1464
|
+
--line-strong: var(--band-panel-line-strong);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1396
1467
|
/* ── Cards and listings ── */
|
|
1397
1468
|
|
|
1398
1469
|
/* An entry's card (A1's news, C1's Blog · cards): raised on the band's card colour, the cover over the words. */
|