@backgold/template-kit 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/chunk-RJAVFRC6.js +67 -0
- package/dist/constants-BAIo_Q5U.d-lQbj1e1-.d.ts +48 -0
- package/dist/content-api-Cox1-wz5.d.ts +1096 -0
- package/dist/contract/content-api-examples.d.ts +72 -0
- package/dist/contract/content-api-examples.js +926 -0
- package/dist/contract/content-api.d.ts +2 -0
- package/dist/contract/content-api.js +1 -0
- package/dist/contract/site-templates.d.ts +253 -0
- package/dist/contract/site-templates.js +185 -0
- package/package.json +70 -3
- package/src/components/EntryCard.astro +35 -0
- package/src/components/EventMap.astro +118 -0
- package/src/components/EventPage.astro +194 -0
- package/src/components/FieldValue.astro +41 -0
- package/src/components/LeadingHero.astro +21 -0
- package/src/components/NotFound.astro +20 -0
- package/src/components/PageSections.astro +47 -0
- package/src/components/Prose.astro +18 -0
- package/src/components/chrome/Brand.astro +61 -0
- package/src/components/chrome/ClosingCall.astro +94 -0
- package/src/components/chrome/DonateStrip.astro +61 -0
- package/src/components/chrome/FooterColumns.astro +32 -0
- package/src/components/chrome/FooterContact.astro +28 -0
- package/src/components/chrome/MenuList.astro +45 -0
- package/src/components/chrome/ModeToggle.astro +125 -0
- package/src/components/chrome/SignedInNotice.astro +53 -0
- package/src/components/chrome/SignupBand.astro +12 -0
- package/src/components/chrome/TakeoverBanner.astro +56 -0
- package/src/components/chrome/VisitorAccount.astro +82 -0
- package/src/components/entries/AuthorBox.astro +47 -0
- package/src/components/entries/EntryFields.astro +29 -0
- package/src/components/entries/EntryHeader.astro +77 -0
- package/src/components/entries/ListFrame.astro +126 -0
- package/src/components/entries/ListSearch.astro +24 -0
- package/src/components/entries/Share.astro +24 -0
- package/src/components/entries/course/classroom.astro +26 -0
- package/src/components/entries/course/lesson.astro +18 -0
- package/src/components/entries/course/section.ts +20 -0
- package/src/components/entries/course/syllabus.astro +15 -0
- package/src/components/entries/index.ts +77 -0
- package/src/components/entries/newsletter/issue.astro +41 -0
- package/src/components/entries/newsletter/list.astro +26 -0
- package/src/components/entries/podcast/episode.astro +42 -0
- package/src/components/entries/podcast/list.astro +36 -0
- package/src/components/entries/post/article.astro +31 -0
- package/src/components/entries/post/list.astro +85 -0
- package/src/components/entries/props.ts +61 -0
- package/src/components/entries/video/cards.astro +39 -0
- package/src/components/entries/video/grid.astro +15 -0
- package/src/components/entries/video/watch.astro +41 -0
- package/src/components/live/LivePage.astro +215 -0
- package/src/components/live/LocalTime.astro +29 -0
- package/src/components/sections/About/books.astro +188 -0
- package/src/components/sections/About/credentials.ts +80 -0
- package/src/components/sections/About/index.astro +60 -0
- package/src/components/sections/About/left.astro +57 -0
- package/src/components/sections/About/letter.astro +111 -0
- package/src/components/sections/About/portrait.astro +308 -0
- package/src/components/sections/Advocacy/compact.astro +14 -0
- package/src/components/sections/Advocacy/index.astro +14 -0
- package/src/components/sections/Band.astro +39 -0
- package/src/components/sections/Blog/feature.astro +176 -0
- package/src/components/sections/Blog/index.astro +37 -0
- package/src/components/sections/Blog/latest.ts +80 -0
- package/src/components/sections/Blog/list.astro +186 -0
- package/src/components/sections/Booking/index.astro +139 -0
- package/src/components/sections/Booking/list.astro +144 -0
- package/src/components/sections/Booking/types.ts +60 -0
- package/src/components/sections/Calendar/agenda.astro +14 -0
- package/src/components/sections/Calendar/index.astro +14 -0
- package/src/components/sections/CandidateRoster/ballot.astro +394 -0
- package/src/components/sections/CandidateRoster/candidates.ts +69 -0
- package/src/components/sections/CandidateRoster/compact.astro +115 -0
- package/src/components/sections/CandidateRoster/index.astro +57 -0
- package/src/components/sections/CaseStudies/beforeafter.astro +222 -0
- package/src/components/sections/CaseStudies/cases.ts +111 -0
- package/src/components/sections/CaseStudies/grid.astro +261 -0
- package/src/components/sections/CaseStudies/index.astro +333 -0
- package/src/components/sections/Classroom/CourseCard.astro +181 -0
- package/src/components/sections/Classroom/Courses.astro +88 -0
- package/src/components/sections/Classroom/classroom.ts +141 -0
- package/src/components/sections/Classroom/index.astro +20 -0
- package/src/components/sections/Classroom/list.astro +15 -0
- package/src/components/sections/Collection/compact.astro +7 -0
- package/src/components/sections/Collection/entries.ts +62 -0
- package/src/components/sections/Collection/feature.astro +180 -0
- package/src/components/sections/Collection/index.astro +46 -0
- package/src/components/sections/Collection/library.astro +271 -0
- package/src/components/sections/Collection/list.astro +7 -0
- package/src/components/sections/Collection/outline.astro +134 -0
- package/src/components/sections/Collection/shelves.astro +191 -0
- package/src/components/sections/Comparison/Unlisted.astro +6 -0
- package/src/components/sections/Comparison/cards.astro +171 -0
- package/src/components/sections/Comparison/index.astro +191 -0
- package/src/components/sections/Comparison/sides.ts +98 -0
- package/src/components/sections/Comparison/spectrum.astro +261 -0
- package/src/components/sections/ContentPost/banner.astro +152 -0
- package/src/components/sections/ContentPost/index.astro +35 -0
- package/src/components/sections/ContentPost/lesson.ts +126 -0
- package/src/components/sections/ContentPost/player.astro +254 -0
- package/src/components/sections/ContentPost/prose.astro +80 -0
- package/src/components/sections/ContentPost/theater.astro +329 -0
- package/src/components/sections/Countdown/index.astro +53 -0
- package/src/components/sections/Course/Bar.astro +46 -0
- package/src/components/sections/Course/CourseHead.astro +123 -0
- package/src/components/sections/Course/Crumbs.astro +44 -0
- package/src/components/sections/Course/Icon.astro +29 -0
- package/src/components/sections/Course/Ring.astro +62 -0
- package/src/components/sections/Course/Syllabus.astro +146 -0
- package/src/components/sections/Course/course.ts +146 -0
- package/src/components/sections/Course/index.astro +143 -0
- package/src/components/sections/Course/outline.astro +39 -0
- package/src/components/sections/Cta/banner.astro +64 -0
- package/src/components/sections/Cta/card.astro +88 -0
- package/src/components/sections/Cta/index.astro +31 -0
- package/src/components/sections/Cta/photo.astro +114 -0
- package/src/components/sections/Cta/strip.astro +91 -0
- package/src/components/sections/Donate/index.astro +136 -0
- package/src/components/sections/Donate/story.astro +7 -0
- package/src/components/sections/Event/card.astro +14 -0
- package/src/components/sections/Event/index.astro +14 -0
- package/src/components/sections/EventsList/AgendaMonths.astro +105 -0
- package/src/components/sections/EventsList/CalendarLine.astro +23 -0
- package/src/components/sections/EventsList/EventRows.astro +196 -0
- package/src/components/sections/EventsList/LiveCounts.astro +75 -0
- package/src/components/sections/EventsList/TypeTabs.astro +53 -0
- package/src/components/sections/EventsList/agenda.astro +55 -0
- package/src/components/sections/EventsList/calendar.astro +392 -0
- package/src/components/sections/EventsList/cards.astro +186 -0
- package/src/components/sections/EventsList/cohorts.astro +205 -0
- package/src/components/sections/EventsList/compact.astro +163 -0
- package/src/components/sections/EventsList/events.ts +168 -0
- package/src/components/sections/EventsList/index.astro +46 -0
- package/src/components/sections/EventsList/map.astro +436 -0
- package/src/components/sections/EventsList/shifts.astro +355 -0
- package/src/components/sections/EventsList/week.astro +361 -0
- package/src/components/sections/Faq/Contact.astro +63 -0
- package/src/components/sections/Faq/Questions.astro +98 -0
- package/src/components/sections/Faq/cards.astro +74 -0
- package/src/components/sections/Faq/faq.ts +101 -0
- package/src/components/sections/Faq/index.astro +49 -0
- package/src/components/sections/Faq/topics.astro +178 -0
- package/src/components/sections/Financials/Foot.astro +38 -0
- package/src/components/sections/Financials/Head.astro +47 -0
- package/src/components/sections/Financials/donut.astro +197 -0
- package/src/components/sections/Financials/financials.ts +52 -0
- package/src/components/sections/Financials/index.astro +148 -0
- package/src/components/sections/Financials/table.astro +157 -0
- package/src/components/sections/FormBlock/index.astro +33 -0
- package/src/components/sections/FormBlock/wide.astro +7 -0
- package/src/components/sections/Hero/cover.astro +176 -0
- package/src/components/sections/Hero/donate.astro +209 -0
- package/src/components/sections/Hero/field.astro +390 -0
- package/src/components/sections/Hero/index.astro +52 -0
- package/src/components/sections/Hero/overlap.astro +151 -0
- package/src/components/sections/Hero/rotating.astro +30 -0
- package/src/components/sections/Hero/split.astro +99 -0
- package/src/components/sections/Hero/statement.astro +55 -0
- package/src/components/sections/Hero/video.astro +399 -0
- package/src/components/sections/Issues/checklist.astro +204 -0
- package/src/components/sections/Issues/drawer.astro +237 -0
- package/src/components/sections/Issues/index.astro +115 -0
- package/src/components/sections/Issues/issues.ts +37 -0
- package/src/components/sections/Issues/numbered.astro +79 -0
- package/src/components/sections/Issues/rows.astro +137 -0
- package/src/components/sections/Issues/steps.astro +81 -0
- package/src/components/sections/Issues/tabs.astro +322 -0
- package/src/components/sections/Leaderboard/index.astro +29 -0
- package/src/components/sections/Lesson/Door.astro +121 -0
- package/src/components/sections/Lesson/LessonBody.astro +416 -0
- package/src/components/sections/Lesson/Rail.astro +182 -0
- package/src/components/sections/Lesson/Tracker.astro +137 -0
- package/src/components/sections/Lesson/index.astro +27 -0
- package/src/components/sections/Lesson/lesson.ts +233 -0
- package/src/components/sections/Lesson/reading.astro +21 -0
- package/src/components/sections/Map/CoverageLine.astro +19 -0
- package/src/components/sections/Map/RegionMap.astro +109 -0
- package/src/components/sections/Map/bar.astro +160 -0
- package/src/components/sections/Map/index.astro +192 -0
- package/src/components/sections/Map/map.astro +275 -0
- package/src/components/sections/MediaKit/BioCard.astro +108 -0
- package/src/components/sections/MediaKit/Downloads.astro +88 -0
- package/src/components/sections/MediaKit/index.astro +183 -0
- package/src/components/sections/MediaKit/kit.ts +140 -0
- package/src/components/sections/MediaKit/press.astro +189 -0
- package/src/components/sections/MediaKit/speaker.astro +205 -0
- package/src/components/sections/Membership/Benefits.astro +42 -0
- package/src/components/sections/Membership/Check.astro +12 -0
- package/src/components/sections/Membership/Price.astro +61 -0
- package/src/components/sections/Membership/compare.astro +312 -0
- package/src/components/sections/Membership/index.astro +281 -0
- package/src/components/sections/Membership/offers.ts +169 -0
- package/src/components/sections/Membership/tiers.astro +217 -0
- package/src/components/sections/MovementMap/index.astro +50 -0
- package/src/components/sections/MovementTicker/index.astro +43 -0
- package/src/components/sections/Pathways/Doors.astro +147 -0
- package/src/components/sections/Pathways/Head.astro +37 -0
- package/src/components/sections/Pathways/index.astro +27 -0
- package/src/components/sections/Pathways/pathways.ts +100 -0
- package/src/components/sections/Pathways/quiz.astro +286 -0
- package/src/components/sections/Pathways/tabs.astro +271 -0
- package/src/components/sections/PdfEmbed/card.astro +99 -0
- package/src/components/sections/PdfEmbed/index.astro +26 -0
- package/src/components/sections/PdfEmbed/medium.astro +7 -0
- package/src/components/sections/PdfEmbed/tall.astro +7 -0
- package/src/components/sections/Petition/coverage.astro +14 -0
- package/src/components/sections/Petition/image.astro +14 -0
- package/src/components/sections/Petition/index.astro +14 -0
- package/src/components/sections/Petition/map.astro +14 -0
- package/src/components/sections/PlatformPlanks/anchors.ts +66 -0
- package/src/components/sections/PlatformPlanks/columns.astro +171 -0
- package/src/components/sections/PlatformPlanks/index.astro +56 -0
- package/src/components/sections/PlatformPlanks/longread.astro +250 -0
- package/src/components/sections/PollBlock/index.astro +30 -0
- package/src/components/sections/Portfolio/featured.astro +343 -0
- package/src/components/sections/Portfolio/index.astro +571 -0
- package/src/components/sections/Portfolio/strip.astro +173 -0
- package/src/components/sections/Portfolio/work.ts +100 -0
- package/src/components/sections/Progress/MatchClock.astro +166 -0
- package/src/components/sections/Progress/compact.astro +150 -0
- package/src/components/sections/Progress/index.astro +32 -0
- package/src/components/sections/Progress/match.astro +126 -0
- package/src/components/sections/Progress/ring.astro +179 -0
- package/src/components/sections/QuickDonate/DonateCard.astro +149 -0
- package/src/components/sections/QuickDonate/Picker.astro +95 -0
- package/src/components/sections/QuickDonate/band.astro +164 -0
- package/src/components/sections/QuickDonate/bar.astro +208 -0
- package/src/components/sections/QuickDonate/donate.ts +126 -0
- package/src/components/sections/QuickDonate/hero.astro +143 -0
- package/src/components/sections/QuickDonate/index.astro +73 -0
- package/src/components/sections/QuickDonate/jar.astro +225 -0
- package/src/components/sections/QuickDonate/ladder.astro +248 -0
- package/src/components/sections/QuoteStrip/carousel.astro +340 -0
- package/src/components/sections/QuoteStrip/index.astro +58 -0
- package/src/components/sections/QuoteStrip/logos.astro +226 -0
- package/src/components/sections/QuoteStrip/quotes.ts +61 -0
- package/src/components/sections/QuoteStrip/single.astro +92 -0
- package/src/components/sections/QuoteStrip/ticker.astro +319 -0
- package/src/components/sections/QuoteStrip/wall.astro +113 -0
- package/src/components/sections/Resources/band.astro +93 -0
- package/src/components/sections/Resources/featured.astro +239 -0
- package/src/components/sections/Resources/index.astro +225 -0
- package/src/components/sections/Resources/resources.ts +92 -0
- package/src/components/sections/SampleBallot/Position.astro +39 -0
- package/src/components/sections/SampleBallot/ballot.ts +92 -0
- package/src/components/sections/SampleBallot/cards.astro +299 -0
- package/src/components/sections/SampleBallot/index.astro +326 -0
- package/src/components/sections/SampleBallot/measures.astro +172 -0
- package/src/components/sections/Scorecard/grades.astro +141 -0
- package/src/components/sections/Scorecard/index.astro +294 -0
- package/src/components/sections/Scorecard/promise.astro +167 -0
- package/src/components/sections/Scorecard/votes.ts +83 -0
- package/src/components/sections/SectionHead.astro +31 -0
- package/src/components/sections/Services/Button.astro +24 -0
- package/src/components/sections/Services/Check.astro +12 -0
- package/src/components/sections/Services/Includes.astro +42 -0
- package/src/components/sections/Services/compare.astro +328 -0
- package/src/components/sections/Services/index.astro +187 -0
- package/src/components/sections/Services/list.astro +181 -0
- package/src/components/sections/Services/services.ts +80 -0
- package/src/components/sections/ShareKit/Actions.astro +71 -0
- package/src/components/sections/ShareKit/Buttons.astro +62 -0
- package/src/components/sections/ShareKit/compact.astro +123 -0
- package/src/components/sections/ShareKit/index.astro +160 -0
- package/src/components/sections/ShareKit/share.ts +60 -0
- package/src/components/sections/ShareKit/strip.astro +173 -0
- package/src/components/sections/SignupCapture/band.astro +7 -0
- package/src/components/sections/SignupCapture/index.astro +103 -0
- package/src/components/sections/SignupCapture/inline.astro +7 -0
- package/src/components/sections/SocialFeed/index.astro +34 -0
- package/src/components/sections/StatCards/feature.astro +143 -0
- package/src/components/sections/StatCards/index.astro +51 -0
- package/src/components/sections/StatCards/ribbon.astro +113 -0
- package/src/components/sections/StatCards/wall.astro +177 -0
- package/src/components/sections/Store/featured.astro +14 -0
- package/src/components/sections/Store/index.astro +14 -0
- package/src/components/sections/Stories/Status.astro +42 -0
- package/src/components/sections/Stories/StoryCards.astro +171 -0
- package/src/components/sections/Stories/cards.astro +42 -0
- package/src/components/sections/Stories/index.astro +238 -0
- package/src/components/sections/Stories/stories.ts +97 -0
- package/src/components/sections/Stories/timeline.astro +135 -0
- package/src/components/sections/TeamGrid/board.astro +280 -0
- package/src/components/sections/TeamGrid/index.astro +71 -0
- package/src/components/sections/TeamGrid/list.astro +306 -0
- package/src/components/sections/TeamGrid/people.ts +178 -0
- package/src/components/sections/VideoEmbed/index.astro +52 -0
- package/src/components/sections/VideoEmbed/landscape.astro +7 -0
- package/src/components/sections/VideoEmbed/portrait.astro +7 -0
- package/src/components/sections/VideoEmbed/square.astro +7 -0
- package/src/components/sections/VoterTools/DaysLeft.astro +33 -0
- package/src/components/sections/VoterTools/Lookup.astro +43 -0
- package/src/components/sections/VoterTools/dates.astro +153 -0
- package/src/components/sections/VoterTools/index.astro +231 -0
- package/src/components/sections/VoterTools/polling.astro +144 -0
- package/src/components/sections/VoterTools/voter-tools.ts +71 -0
- package/src/components/sections/index.ts +373 -0
- package/src/components/sections/modules/Headed.astro +39 -0
- package/src/components/sections/modules/ModuleFrame.astro +181 -0
- 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/ShiftLive.astro +90 -0
- package/src/components/volunteer/detail.astro +247 -0
- package/src/components/volunteer/list.astro +298 -0
- package/src/components/volunteer/props.ts +21 -0
- package/src/env.d.ts +22 -0
- package/src/index.d.ts +10 -0
- package/src/index.js +63 -0
- package/src/layouts/Site.astro +387 -0
- package/src/lib/academy.ts +146 -0
- package/src/lib/brand.ts +534 -0
- package/src/lib/chrome.ts +121 -0
- package/src/lib/donate-frame.ts +104 -0
- package/src/lib/entries.ts +190 -0
- package/src/lib/env.ts +34 -0
- package/src/lib/event-map-draw.ts +91 -0
- package/src/lib/events.ts +476 -0
- package/src/lib/fonts.ts +116 -0
- package/src/lib/footer.ts +24 -0
- package/src/lib/format.ts +160 -0
- package/src/lib/geo.ts +131 -0
- package/src/lib/live.ts +55 -0
- package/src/lib/menu.ts +48 -0
- package/src/lib/petition-text.ts +29 -0
- package/src/lib/reading.ts +17 -0
- package/src/lib/regions.ts +215 -0
- package/src/lib/section.ts +105 -0
- package/src/lib/shifts.ts +187 -0
- package/src/lib/store.ts +521 -0
- package/src/lib/stream-time.ts +20 -0
- package/src/lib/stream.ts +141 -0
- package/src/lib/visitor.ts +54 -0
- package/src/routes/catch-all.astro +435 -0
- package/src/routes/form.astro +30 -0
- package/src/routes/live.astro +49 -0
- package/src/routes/not-found.astro +18 -0
- package/src/routes/preview.astro +60 -0
- package/src/routes/setup.astro +62 -0
- package/src/routes/volunteer-shift.astro +61 -0
- package/src/styles/entries.css +784 -0
- package/src/styles/site.css +1910 -0
- package/src/styles/store.css +634 -0
- package/src/template.ts +182 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The course list layout, `classroom` (board D1): the courses list page's
|
|
3
|
+
// head (ListFrame: the list's name as the <h1>, the pager) over the
|
|
4
|
+
// Classroom section's Grid, its courses read from `GET /courses` for this
|
|
5
|
+
// visitor (sections/Classroom/classroom.ts): each card's bar with a
|
|
6
|
+
// visitor, what it takes to watch without one.
|
|
7
|
+
import ClassroomGrid from '../../sections/Classroom/index.astro'
|
|
8
|
+
import ListFrame from '../ListFrame.astro'
|
|
9
|
+
import type { ListLayoutProps } from '../props'
|
|
10
|
+
import { academySection } from './section'
|
|
11
|
+
|
|
12
|
+
type Props = ListLayoutProps
|
|
13
|
+
|
|
14
|
+
const props = Astro.props
|
|
15
|
+
---
|
|
16
|
+
<ListFrame {...props} noun="courses" class="list-courses">
|
|
17
|
+
<ClassroomGrid section={academySection('Classroom', 'grid')} from="read" />
|
|
18
|
+
</ListFrame>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
/* The list's own column holds the cards: the section adds no band or padding of its own. */
|
|
22
|
+
:global(.list-courses .classroom) {
|
|
23
|
+
--bg-section-padding: 0;
|
|
24
|
+
background: none;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A lesson's own page (board D3), at `/<courses base>/<course>/<lesson>`:
|
|
3
|
+
// the Lesson section's Player layout drawn from the lesson the route already
|
|
4
|
+
// read for this visitor (`lesson`, LessonLayoutProps), its title the page's
|
|
5
|
+
// <h1>.
|
|
6
|
+
import LessonPlayer from '../../sections/Lesson/index.astro'
|
|
7
|
+
import { lessonView } from '../../sections/Lesson/lesson'
|
|
8
|
+
import type { LessonLayoutProps } from '../props'
|
|
9
|
+
import { orgNameOf, visitorOf } from '../../../lib/visitor'
|
|
10
|
+
import { academySection } from './section'
|
|
11
|
+
import '../../../styles/entries.css'
|
|
12
|
+
|
|
13
|
+
type Props = LessonLayoutProps
|
|
14
|
+
|
|
15
|
+
const { lesson } = Astro.props
|
|
16
|
+
const view = lessonView(lesson, visitorOf(Astro.locals), Astro.url.pathname, orgNameOf(Astro.locals))
|
|
17
|
+
---
|
|
18
|
+
<LessonPlayer section={academySection('Lesson', 'player', lesson.course.slug)} view={view} lead />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The section a course page, the courses list or a lesson page draws its
|
|
2
|
+
// academy layout as: no words, no rows, the plain band, the course pinned
|
|
3
|
+
// when the page is one course's. The layout then reads the course for this
|
|
4
|
+
// visitor itself (sections/Course/course.ts, sections/Classroom/classroom.ts).
|
|
5
|
+
|
|
6
|
+
import type { Section } from '@backgold/content'
|
|
7
|
+
|
|
8
|
+
export function academySection(type: 'Classroom' | 'Course' | 'Lesson', variant: string, courseSlug: string | null = null): Section {
|
|
9
|
+
return {
|
|
10
|
+
id: `${type.toLowerCase()}-page`,
|
|
11
|
+
type,
|
|
12
|
+
band: 'plain',
|
|
13
|
+
bleed: 'full',
|
|
14
|
+
variant,
|
|
15
|
+
copy: {},
|
|
16
|
+
media: {},
|
|
17
|
+
links: [],
|
|
18
|
+
options: courseSlug ? { courseSlug } : {},
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The course entry layout, `syllabus` (board D2): the course's own page is
|
|
3
|
+
// the Course section's Syllabus layout with the course pinned to this entry,
|
|
4
|
+
// its title the page's <h1>. Its lessons, this visitor's place and the
|
|
5
|
+
// locks are read for the visitor by the section (sections/Course/course.ts).
|
|
6
|
+
import CourseSyllabus from '../../sections/Course/index.astro'
|
|
7
|
+
import type { EntryLayoutProps } from '../props'
|
|
8
|
+
import { academySection } from './section'
|
|
9
|
+
import '../../../styles/entries.css'
|
|
10
|
+
|
|
11
|
+
type Props = EntryLayoutProps
|
|
12
|
+
|
|
13
|
+
const { entry } = Astro.props
|
|
14
|
+
---
|
|
15
|
+
<CourseSyllabus section={academySection('Course', 'syllabus', entry.slug)} lead />
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Which component draws an entry, and which draws a list, by content type, as
|
|
2
|
+
// the template's template.json `entryLayouts` names them. Each routable
|
|
3
|
+
// built-in type has a directory, `<type>/<layout>.astro`, one file for its
|
|
4
|
+
// entry layout and one for its list layout; each is registered below as
|
|
5
|
+
// '<type>:<layout>', and a template's `entries` (src/template.ts) is this map
|
|
6
|
+
// with any layouts of its own added. A type template.json does not name (one
|
|
7
|
+
// the organization adds in BackGold) is drawn with the post layouts.
|
|
8
|
+
//
|
|
9
|
+
// To give a type a different layout, add the file, register it in the
|
|
10
|
+
// template's `entries`, and change the name in its template.json.
|
|
11
|
+
//
|
|
12
|
+
// A lesson (`/<courses base>/<course>/<lesson>`) is not an entry of a type
|
|
13
|
+
// of its own: it is drawn by the template's `course:lesson` (the kit's is
|
|
14
|
+
// the Lesson section's Player layout), given LessonLayoutProps
|
|
15
|
+
// (lessonLayoutFor).
|
|
16
|
+
//
|
|
17
|
+
// The volunteer pages are not a type's either: `/volunteer` is drawn by the
|
|
18
|
+
// template's `volunteer:list` and `/volunteer/<slug>` by its
|
|
19
|
+
// `volunteer:detail` (the kit's components/volunteer, when the template
|
|
20
|
+
// registers none), given VolunteerListProps and VolunteerDetailProps
|
|
21
|
+
// (volunteerLayoutFor).
|
|
22
|
+
|
|
23
|
+
import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
|
|
24
|
+
import type { TemplateConfig } from '../../template'
|
|
25
|
+
import CourseClassroom from './course/classroom.astro'
|
|
26
|
+
import CourseLesson from './course/lesson.astro'
|
|
27
|
+
import CourseSyllabus from './course/syllabus.astro'
|
|
28
|
+
import NewsletterIssue from './newsletter/issue.astro'
|
|
29
|
+
import NewsletterList from './newsletter/list.astro'
|
|
30
|
+
import PodcastEpisode from './podcast/episode.astro'
|
|
31
|
+
import PodcastList from './podcast/list.astro'
|
|
32
|
+
import PostArticle from './post/article.astro'
|
|
33
|
+
import PostList from './post/list.astro'
|
|
34
|
+
import VideoGrid from './video/grid.astro'
|
|
35
|
+
import VideoWatch from './video/watch.astro'
|
|
36
|
+
import VolunteerDetail from '../volunteer/detail.astro'
|
|
37
|
+
import VolunteerList from '../volunteer/list.astro'
|
|
38
|
+
|
|
39
|
+
export const entries = {
|
|
40
|
+
'post:article': PostArticle,
|
|
41
|
+
'podcast:episode': PodcastEpisode,
|
|
42
|
+
'video:watch': VideoWatch,
|
|
43
|
+
'newsletter:issue': NewsletterIssue,
|
|
44
|
+
'course:syllabus': CourseSyllabus,
|
|
45
|
+
'post:list': PostList,
|
|
46
|
+
'podcast:list': PodcastList,
|
|
47
|
+
'video:grid': VideoGrid,
|
|
48
|
+
'newsletter:list': NewsletterList,
|
|
49
|
+
'course:classroom': CourseClassroom,
|
|
50
|
+
'course:lesson': CourseLesson,
|
|
51
|
+
'volunteer:list': VolunteerList,
|
|
52
|
+
'volunteer:detail': VolunteerDetail,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function pick(template: TemplateConfig, key: string, which: 'entry' | 'list', fallback: AstroComponentFactory): AstroComponentFactory {
|
|
56
|
+
const named: Record<string, { entry: string; list: string }> = template.manifest.entryLayouts
|
|
57
|
+
/** The type key whose layouts draw `key`: itself when template.json names it, else post. */
|
|
58
|
+
const type = Object.hasOwn(named, key) ? key : 'post'
|
|
59
|
+
const name = `${type}:${named[type]![which]}`
|
|
60
|
+
return Object.hasOwn(template.entries, name) ? template.entries[name]! : fallback
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The template's entry layout for an entry of type `key`. */
|
|
64
|
+
export const entryLayoutFor = (template: TemplateConfig, key: string) => pick(template, key, 'entry', PostArticle)
|
|
65
|
+
|
|
66
|
+
/** The template's list layout for a list of type `key` (`post` for the built-in types' shared list). */
|
|
67
|
+
export const listLayoutFor = (template: TemplateConfig, key: string) => pick(template, key, 'list', PostList)
|
|
68
|
+
|
|
69
|
+
/** The template's lesson layout: the `course:lesson` its entries register, else the kit's. */
|
|
70
|
+
export const lessonLayoutFor = (template: TemplateConfig): AstroComponentFactory =>
|
|
71
|
+
Object.hasOwn(template.entries, 'course:lesson') ? template.entries['course:lesson']! : CourseLesson
|
|
72
|
+
|
|
73
|
+
/** The template's volunteer layout: the `volunteer:list` (or `volunteer:detail`) its entries register, else the kit's. */
|
|
74
|
+
export function volunteerLayoutFor(template: TemplateConfig, which: 'list' | 'detail'): AstroComponentFactory {
|
|
75
|
+
const name = `volunteer:${which}`
|
|
76
|
+
return Object.hasOwn(template.entries, name) ? template.entries[name]! : which === 'list' ? VolunteerList : VolunteerDetail
|
|
77
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The newsletter entry layout, `issue`: the issue's line over the title (its
|
|
3
|
+
// `issue` field, like "October 2026", else the type's name), the headline,
|
|
4
|
+
// the preheader, the date, the issue itself in the reading column, Share,
|
|
5
|
+
// and a closing call to get the next one. Signing up is BackGold's own form,
|
|
6
|
+
// never this template's: when this page's Above the footer area holds a
|
|
7
|
+
// sign-up the call points down to it, and otherwise to the past issues.
|
|
8
|
+
import { areaEntriesOf, renderMarkdown } from '@backgold/astro/server'
|
|
9
|
+
import EntryFields from '../EntryFields.astro'
|
|
10
|
+
import EntryHeader from '../EntryHeader.astro'
|
|
11
|
+
import Share from '../Share.astro'
|
|
12
|
+
import type { EntryLayoutProps } from '../props'
|
|
13
|
+
import { listOf } from '../../../lib/entries'
|
|
14
|
+
import { text } from '../../../lib/format'
|
|
15
|
+
import '../../../styles/entries.css'
|
|
16
|
+
|
|
17
|
+
type Props = EntryLayoutProps
|
|
18
|
+
|
|
19
|
+
const { entry, type, areas } = Astro.props
|
|
20
|
+
const line = text(entry.fields?.issue) ?? type?.singular_label ?? 'Newsletter'
|
|
21
|
+
const body = entry.body?.markdown ? renderMarkdown(entry.body.markdown) : ''
|
|
22
|
+
const signupBelow = areaEntriesOf(areas, 'above_footer').some(
|
|
23
|
+
({ item, needsWindow }) => !needsWindow && item.sections.some((section) => section.type === 'SignupCapture'),
|
|
24
|
+
)
|
|
25
|
+
const past = listOf(type)?.path ?? null
|
|
26
|
+
---
|
|
27
|
+
<article class="entry entry-issue">
|
|
28
|
+
<EntryHeader entry={entry} type={type} kicker={line} />
|
|
29
|
+
{body ? <div class="prose entry-body" set:html={body} /> : <p class="empty">This issue has no text yet.</p>}
|
|
30
|
+
<EntryFields entry={entry} type={type} omit={['issue']} />
|
|
31
|
+
{entry.url && <Share title={entry.title} path={entry.url} />}
|
|
32
|
+
{(signupBelow || past) && (
|
|
33
|
+
<aside class="issue-next bg-band-tint" aria-labelledby="issue-next">
|
|
34
|
+
<h2 id="issue-next">Get the next issue</h2>
|
|
35
|
+
<p>One email when the next issue goes out.</p>
|
|
36
|
+
<p class="actions">
|
|
37
|
+
{signupBelow ? <a class="button" href="#above-the-footer">Sign up below</a> : <a class="button" href={past}>Read past issues</a>}
|
|
38
|
+
</p>
|
|
39
|
+
</aside>
|
|
40
|
+
)}
|
|
41
|
+
</article>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The newsletter list layout, `list`: the past issues, newest first, each
|
|
3
|
+
// with its date, its headline and its preheader.
|
|
4
|
+
import { safeHref } from '@backgold/astro/server'
|
|
5
|
+
import ListFrame from '../ListFrame.astro'
|
|
6
|
+
import type { ListLayoutProps } from '../props'
|
|
7
|
+
import { formatDay } from '../../../lib/format'
|
|
8
|
+
|
|
9
|
+
type Props = ListLayoutProps
|
|
10
|
+
|
|
11
|
+
const props = Astro.props
|
|
12
|
+
const issues = props.entries.map((entry) => ({ entry, href: entry.url ? safeHref(entry.url) : null, day: formatDay(entry.publish_at) }))
|
|
13
|
+
---
|
|
14
|
+
<ListFrame {...props} noun="issues" class="list-issues">
|
|
15
|
+
<ol class="issue-rows" role="list">
|
|
16
|
+
{issues.map((issue) => (
|
|
17
|
+
<li class="issue-row">
|
|
18
|
+
{issue.day && issue.entry.publish_at && <time datetime={issue.entry.publish_at}>{issue.day}</time>}
|
|
19
|
+
<div>
|
|
20
|
+
<h2 class="issue-row-title">{issue.href ? <a href={issue.href}>{issue.entry.title}</a> : issue.entry.title}</h2>
|
|
21
|
+
{issue.entry.summary && <p>{issue.entry.summary}</p>}
|
|
22
|
+
</div>
|
|
23
|
+
</li>
|
|
24
|
+
))}
|
|
25
|
+
</ol>
|
|
26
|
+
</ListFrame>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The podcast entry layout, `episode`: the header with the type's own word
|
|
3
|
+
// over the title ("Episode"), the episode's art beside the player (the
|
|
4
|
+
// browser's own audio controls, reading the entry's media file), then the
|
|
5
|
+
// show notes (the entry's body), its fields, Share, and the hosts.
|
|
6
|
+
import { renderMarkdown, safeSrc } from '@backgold/astro/server'
|
|
7
|
+
import AuthorBox from '../AuthorBox.astro'
|
|
8
|
+
import EntryFields from '../EntryFields.astro'
|
|
9
|
+
import EntryHeader from '../EntryHeader.astro'
|
|
10
|
+
import Share from '../Share.astro'
|
|
11
|
+
import type { EntryLayoutProps } from '../props'
|
|
12
|
+
import '../../../styles/entries.css'
|
|
13
|
+
|
|
14
|
+
type Props = EntryLayoutProps
|
|
15
|
+
|
|
16
|
+
const { entry, type } = Astro.props
|
|
17
|
+
const art = entry.hero ? safeSrc(entry.hero.url) : null
|
|
18
|
+
const audio = safeSrc(entry.media_url)
|
|
19
|
+
const notes = entry.body?.markdown ? renderMarkdown(entry.body.markdown) : ''
|
|
20
|
+
---
|
|
21
|
+
<article class="entry entry-episode">
|
|
22
|
+
<EntryHeader entry={entry} type={type} kicker={type?.singular_label ?? 'Episode'} />
|
|
23
|
+
<div class="episode-player">
|
|
24
|
+
{art && <img class="episode-art" src={art} alt="" width="160" height="160" decoding="async" />}
|
|
25
|
+
{audio ? (
|
|
26
|
+
<audio src={audio} controls preload="none">
|
|
27
|
+
<a href={audio}>Download the episode</a>
|
|
28
|
+
</audio>
|
|
29
|
+
) : (
|
|
30
|
+
<p class="empty">The audio for this episode is not up yet.</p>
|
|
31
|
+
)}
|
|
32
|
+
</div>
|
|
33
|
+
{notes && (
|
|
34
|
+
<section class="show-notes" aria-labelledby="show-notes">
|
|
35
|
+
<h2 id="show-notes">Show notes</h2>
|
|
36
|
+
<div class="prose entry-body" set:html={notes} />
|
|
37
|
+
</section>
|
|
38
|
+
)}
|
|
39
|
+
<EntryFields entry={entry} type={type} />
|
|
40
|
+
{entry.url && <Share title={entry.title} path={entry.url} />}
|
|
41
|
+
<AuthorBox authors={entry.authors} />
|
|
42
|
+
</article>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The podcast list layout, `list`: one episode per row, newest first, with
|
|
3
|
+
// its art, the date, the title, the summary and a Listen link to the
|
|
4
|
+
// episode's page, where the player is.
|
|
5
|
+
import { safeHref, safeSrc } from '@backgold/astro/server'
|
|
6
|
+
import ListFrame from '../ListFrame.astro'
|
|
7
|
+
import type { ListLayoutProps } from '../props'
|
|
8
|
+
import { formatDay } from '../../../lib/format'
|
|
9
|
+
|
|
10
|
+
type Props = ListLayoutProps
|
|
11
|
+
|
|
12
|
+
const props = Astro.props
|
|
13
|
+
const rows = props.entries.map((entry) => ({
|
|
14
|
+
entry,
|
|
15
|
+
href: entry.url ? safeHref(entry.url) : null,
|
|
16
|
+
art: entry.hero ? safeSrc(entry.hero.url) : null,
|
|
17
|
+
day: formatDay(entry.publish_at),
|
|
18
|
+
}))
|
|
19
|
+
---
|
|
20
|
+
<ListFrame {...props} noun="episodes" class="list-episodes">
|
|
21
|
+
<ol class="episode-rows" role="list">
|
|
22
|
+
{rows.map((row) => (
|
|
23
|
+
<li class="episode-row">
|
|
24
|
+
<article>
|
|
25
|
+
{row.art ? <img class="episode-row-art" src={row.art} alt="" width="96" height="96" loading="lazy" decoding="async" /> : <span class="episode-row-art" aria-hidden="true"></span>}
|
|
26
|
+
<div>
|
|
27
|
+
{row.day && row.entry.publish_at && <p class="kicker"><time datetime={row.entry.publish_at}>{row.day}</time></p>}
|
|
28
|
+
<h2 class="episode-row-title">{row.href ? <a href={row.href}>{row.entry.title}</a> : row.entry.title}</h2>
|
|
29
|
+
{row.entry.summary && <p>{row.entry.summary}</p>}
|
|
30
|
+
{row.href && <p class="episode-row-listen"><a href={row.href} aria-label={`Listen to ${row.entry.title}`}>Listen</a></p>}
|
|
31
|
+
</div>
|
|
32
|
+
</article>
|
|
33
|
+
</li>
|
|
34
|
+
))}
|
|
35
|
+
</ol>
|
|
36
|
+
</ListFrame>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The post entry layout, `article` (board A5), and the layout of every entry
|
|
3
|
+
// of a type the organization adds: the header (breadcrumb, terms, title,
|
|
4
|
+
// summary, byline with the reading time), the cover, the body in one reading
|
|
5
|
+
// column, the type's own fields, Share, and who wrote it. The entry's fields
|
|
6
|
+
// come in a fixed order; the operator writes the post, never arranges it.
|
|
7
|
+
import { relFor, renderMarkdown, safeSrc } from '@backgold/astro/server'
|
|
8
|
+
import AuthorBox from '../AuthorBox.astro'
|
|
9
|
+
import EntryFields from '../EntryFields.astro'
|
|
10
|
+
import EntryHeader from '../EntryHeader.astro'
|
|
11
|
+
import Share from '../Share.astro'
|
|
12
|
+
import type { EntryLayoutProps } from '../props'
|
|
13
|
+
import { readingMinutes } from '../../../lib/entries'
|
|
14
|
+
import '../../../styles/entries.css'
|
|
15
|
+
|
|
16
|
+
type Props = EntryLayoutProps
|
|
17
|
+
|
|
18
|
+
const { entry, type } = Astro.props
|
|
19
|
+
const hero = entry.hero ? safeSrc(entry.hero.url) : null
|
|
20
|
+
const media = safeSrc(entry.media_url)
|
|
21
|
+
const body = entry.body?.markdown ? renderMarkdown(entry.body.markdown) : ''
|
|
22
|
+
---
|
|
23
|
+
<article class="entry entry-article">
|
|
24
|
+
<EntryHeader entry={entry} type={type} minutes={readingMinutes(entry.body?.markdown)} />
|
|
25
|
+
{hero && <img class="entry-cover" src={hero} alt="" decoding="async" fetchpriority="high" />}
|
|
26
|
+
{media && <p class="entry-media-link"><a href={media} rel={relFor(media)}>Open the media file</a></p>}
|
|
27
|
+
{body && <div class="prose entry-body" set:html={body} />}
|
|
28
|
+
<EntryFields entry={entry} type={type} />
|
|
29
|
+
{entry.url && <Share title={entry.title} path={entry.url} />}
|
|
30
|
+
<AuthorBox authors={entry.authors} />
|
|
31
|
+
</article>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The post list layout, `list` (boards A4 and C10): News, and the list of
|
|
3
|
+
// every type the organization adds. On the list's first page the newest
|
|
4
|
+
// entry leads, large: its cover, the line over its title as a chip (its term
|
|
5
|
+
// in the list's filter, or its type for an episode or a video in News), the
|
|
6
|
+
// title, the summary, and who wrote it (with their picture, or their
|
|
7
|
+
// initials) and when. Every other entry is a row: its picture beside the
|
|
8
|
+
// words, the chip, the title, the summary, and the byline. A later page, and
|
|
9
|
+
// a search's results, are rows alone.
|
|
10
|
+
import { safeHref, safeSrc } from '@backgold/astro/server'
|
|
11
|
+
import ListFrame from '../ListFrame.astro'
|
|
12
|
+
import type { ListLayoutProps } from '../props'
|
|
13
|
+
import { initials, rowTerm, singularOf, writers } from '../../../lib/entries'
|
|
14
|
+
import { formatShortDay } from '../../../lib/format'
|
|
15
|
+
|
|
16
|
+
type Props = ListLayoutProps
|
|
17
|
+
|
|
18
|
+
const props = Astro.props
|
|
19
|
+
const bg = Astro.locals.backgold
|
|
20
|
+
const types = props.type === 'blog' && bg.setup === null ? (await bg.client.types()).types : []
|
|
21
|
+
const rows = props.entries.map((entry) => {
|
|
22
|
+
const term = rowTerm(entry, props.filter?.taxonomy)
|
|
23
|
+
const kind = entry.type !== 'post' ? singularOf(types, entry.type) : null
|
|
24
|
+
const by = writers(entry.authors)
|
|
25
|
+
const first = by[0]
|
|
26
|
+
return {
|
|
27
|
+
entry,
|
|
28
|
+
href: entry.url ? safeHref(entry.url) : null,
|
|
29
|
+
image: entry.hero ? safeSrc(entry.hero.url) : null,
|
|
30
|
+
line: [kind, term?.label].filter(Boolean).join(' · ') || null,
|
|
31
|
+
by: by.map((a) => a.display_name).join(', ') || null,
|
|
32
|
+
avatar: first ? { url: safeSrc(first.avatar_url), initials: initials(first.display_name) } : null,
|
|
33
|
+
day: formatShortDay(entry.publish_at),
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
const lead = props.pager.newest === null && props.search?.q == null ? (rows[0] ?? null) : null
|
|
37
|
+
const rest = lead ? rows.slice(1) : rows
|
|
38
|
+
---
|
|
39
|
+
<ListFrame {...props} noun={props.type === 'blog' ? 'posts' : props.type.plural_label.toLowerCase()} class="list-posts">
|
|
40
|
+
{lead && (
|
|
41
|
+
<article class="post-lead">
|
|
42
|
+
{lead.image && <img class="post-lead-image" src={lead.image} alt="" loading="lazy" decoding="async" />}
|
|
43
|
+
<div class="post-lead-body">
|
|
44
|
+
{lead.line && <p class="post-chips"><span class="chip chip-wash">{lead.line}</span></p>}
|
|
45
|
+
<h2 class="post-lead-title">{lead.href ? <a href={lead.href}>{lead.entry.title}</a> : lead.entry.title}</h2>
|
|
46
|
+
{lead.entry.summary && <p class="post-lead-summary">{lead.entry.summary}</p>}
|
|
47
|
+
{(lead.by || lead.day) && (
|
|
48
|
+
<p class="post-byline post-lead-byline">
|
|
49
|
+
{lead.avatar && (lead.avatar.url ? <img class="post-avatar" src={lead.avatar.url} alt="" loading="lazy" decoding="async" /> : <span class="post-avatar" aria-hidden="true">{lead.avatar.initials}</span>)}
|
|
50
|
+
<span>
|
|
51
|
+
{lead.by && <b>{lead.by}</b>}
|
|
52
|
+
{lead.by && lead.day && ' · '}
|
|
53
|
+
{lead.day && lead.entry.publish_at && <time datetime={lead.entry.publish_at}>{lead.day}</time>}
|
|
54
|
+
</span>
|
|
55
|
+
</p>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
</article>
|
|
59
|
+
)}
|
|
60
|
+
{rest.length > 0 && (
|
|
61
|
+
<ol class="post-rows" role="list">
|
|
62
|
+
{rest.map((row) => (
|
|
63
|
+
<li class="post-row">
|
|
64
|
+
<article>
|
|
65
|
+
{row.image && <img class="post-row-image" src={row.image} alt="" loading="lazy" decoding="async" />}
|
|
66
|
+
<div class="post-row-body">
|
|
67
|
+
{row.line && <p class="post-chips"><span class="chip chip-wash">{row.line}</span></p>}
|
|
68
|
+
<h2 class="post-row-title">{row.href ? <a href={row.href}>{row.entry.title}</a> : row.entry.title}</h2>
|
|
69
|
+
{row.entry.summary && <p class="post-row-summary">{row.entry.summary}</p>}
|
|
70
|
+
{(row.by || row.day) && (
|
|
71
|
+
<p class="post-byline post-row-byline">
|
|
72
|
+
<span>
|
|
73
|
+
{row.by && <b>{row.by}</b>}
|
|
74
|
+
{row.by && row.day && ' · '}
|
|
75
|
+
{row.day && row.entry.publish_at && <time datetime={row.entry.publish_at}>{row.day}</time>}
|
|
76
|
+
</span>
|
|
77
|
+
</p>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
</article>
|
|
81
|
+
</li>
|
|
82
|
+
))}
|
|
83
|
+
</ol>
|
|
84
|
+
)}
|
|
85
|
+
</ListFrame>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// What every entry layout and every list layout is given, by
|
|
2
|
+
// src/routes/catch-all.astro and src/routes/preview.astro.
|
|
3
|
+
|
|
4
|
+
import type { Areas, ContentTypeSummary, Entry, EntryDetail, LessonResponse, PageResponse, TermsResponse } from '@backgold/content'
|
|
5
|
+
import type { Pager, ResolvedType } from '@backgold/astro/server'
|
|
6
|
+
import type { ListFilter } from '../../lib/entries'
|
|
7
|
+
import type { TemplateConfig } from '../../template'
|
|
8
|
+
|
|
9
|
+
export interface EntryLayoutProps {
|
|
10
|
+
entry: EntryDetail
|
|
11
|
+
/** The entry's type from GET /types; without it the custom fields are left out. */
|
|
12
|
+
type: ContentTypeSummary | undefined
|
|
13
|
+
/** The entry's areas (the issue layout looks for a sign-up in them). */
|
|
14
|
+
areas: Areas | null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ListLayoutProps {
|
|
18
|
+
/** The template drawing the list (its intro's sections draw through its sections map). */
|
|
19
|
+
template: TemplateConfig
|
|
20
|
+
type: ResolvedType
|
|
21
|
+
/** The list's address without slashes, as resolveRoute names it: the blog base (`news`) for the news list, the type's url_base for any other. */
|
|
22
|
+
base: string
|
|
23
|
+
/** One page of the list, newest first: the first page, or the one `?cursor=` asked for. */
|
|
24
|
+
entries: Entry[]
|
|
25
|
+
/** The links under the list: Older to the next page, Newest back to the first. */
|
|
26
|
+
pager: Pager
|
|
27
|
+
/** The terms the list offers to narrow it, from its unfiltered first page. */
|
|
28
|
+
filter: ListFilter | null
|
|
29
|
+
/** On a term's list, the term and its taxonomy; null on the whole list. */
|
|
30
|
+
term: { taxonomy: TermsResponse['taxonomy']; term: TermsResponse['terms'][number] } | null
|
|
31
|
+
/** The search box, on the news list and its terms' lists; null on every other list. */
|
|
32
|
+
search: ListSearch | null
|
|
33
|
+
/**
|
|
34
|
+
* The list's own opening, in place of its plain title: the page at the
|
|
35
|
+
* news list's address (resolveRoute's `intro`; the starter's `news` page,
|
|
36
|
+
* whose Hero is board A4's "From the party"), its sections drawn above the
|
|
37
|
+
* list. On the whole news list only; null everywhere else, and when no page
|
|
38
|
+
* sits at that address.
|
|
39
|
+
*/
|
|
40
|
+
intro?: PageResponse | null
|
|
41
|
+
/** The list page's areas (the empty list's invitation looks for a sign-up in them). */
|
|
42
|
+
areas?: Areas | null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ListSearch {
|
|
46
|
+
/** The news list's address, where the box sends `?q=`. */
|
|
47
|
+
action: string
|
|
48
|
+
/** The search the rows answer (`entries` are its results, with no pager); null when they are the list itself. */
|
|
49
|
+
q: string | null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* What the lesson layout is given (src/routes/catch-all.astro): an entry
|
|
54
|
+
* layout's props, the lesson's video entry as `entry` with no `type` and the
|
|
55
|
+
* lesson's areas, and the api's whole answer for this visitor at
|
|
56
|
+
* `/<courses base>/<course>/<lesson>` (the course, the lessons either side).
|
|
57
|
+
*/
|
|
58
|
+
export interface LessonLayoutProps extends EntryLayoutProps {
|
|
59
|
+
type: undefined
|
|
60
|
+
lesson: LessonResponse
|
|
61
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Videos as the video list draws them (grid.astro, and the /live page's
|
|
3
|
+
// newest three, components/live/LivePage.astro): each a card with its picture
|
|
4
|
+
// and a play mark, its title and its date; the whole card opens the video's
|
|
5
|
+
// page. `level` is the titles' heading level: 2 on a list page under its h1,
|
|
6
|
+
// 3 under a section's h2.
|
|
7
|
+
import type { Entry } from '@backgold/content'
|
|
8
|
+
import { safeHref, safeSrc } from '@backgold/astro/server'
|
|
9
|
+
import { formatDay } from '../../../lib/format'
|
|
10
|
+
import '../../../styles/entries.css'
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
entries: Entry[]
|
|
14
|
+
level?: 2 | 3
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { entries, level = 2 } = Astro.props
|
|
18
|
+
const Title = level === 2 ? 'h2' : 'h3'
|
|
19
|
+
const cards = entries.map((entry) => ({
|
|
20
|
+
entry,
|
|
21
|
+
href: entry.url ? safeHref(entry.url) : null,
|
|
22
|
+
still: entry.hero ? safeSrc(entry.hero.url) : null,
|
|
23
|
+
day: formatDay(entry.publish_at),
|
|
24
|
+
}))
|
|
25
|
+
---
|
|
26
|
+
<ul class="video-grid" role="list">
|
|
27
|
+
{cards.map((card) => (
|
|
28
|
+
<li class="card video-card">
|
|
29
|
+
<div class="video-card-still">
|
|
30
|
+
{card.still && <img src={card.still} alt="" loading="lazy" decoding="async" />}
|
|
31
|
+
<span class="video-card-play" aria-hidden="true"></span>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="card-body">
|
|
34
|
+
<Title class="card-title">{card.href ? <a href={card.href}>{card.entry.title}</a> : card.entry.title}</Title>
|
|
35
|
+
{card.day && card.entry.publish_at && <time class="card-date" datetime={card.entry.publish_at}>{card.day}</time>}
|
|
36
|
+
</div>
|
|
37
|
+
</li>
|
|
38
|
+
))}
|
|
39
|
+
</ul>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The video list layout, `grid`: the videos as a grid of pictures, each with
|
|
3
|
+
// a play mark, its title and its date; the whole card opens the video's page
|
|
4
|
+
// (cards.astro).
|
|
5
|
+
import ListFrame from '../ListFrame.astro'
|
|
6
|
+
import type { ListLayoutProps } from '../props'
|
|
7
|
+
import VideoCards from './cards.astro'
|
|
8
|
+
|
|
9
|
+
type Props = ListLayoutProps
|
|
10
|
+
|
|
11
|
+
const props = Astro.props
|
|
12
|
+
---
|
|
13
|
+
<ListFrame {...props} noun="videos" class="list-videos">
|
|
14
|
+
<VideoCards entries={props.entries} level={2} />
|
|
15
|
+
</ListFrame>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The video entry layout, `watch`: the video first and large (a YouTube or
|
|
3
|
+
// Vimeo address in its player, a video file in the browser's own player with
|
|
4
|
+
// the entry's picture as its poster, a link for anything else), then the
|
|
5
|
+
// header, the description (the entry's body) under it, its fields, Share,
|
|
6
|
+
// and who made it.
|
|
7
|
+
import { relFor, renderMarkdown, safeSrc } from '@backgold/astro/server'
|
|
8
|
+
import AuthorBox from '../AuthorBox.astro'
|
|
9
|
+
import EntryFields from '../EntryFields.astro'
|
|
10
|
+
import EntryHeader from '../EntryHeader.astro'
|
|
11
|
+
import Share from '../Share.astro'
|
|
12
|
+
import type { EntryLayoutProps } from '../props'
|
|
13
|
+
import { playerOf } from '../../../lib/entries'
|
|
14
|
+
import '../../../styles/entries.css'
|
|
15
|
+
|
|
16
|
+
type Props = EntryLayoutProps
|
|
17
|
+
|
|
18
|
+
const { entry, type } = Astro.props
|
|
19
|
+
const source = safeSrc(entry.media_url)
|
|
20
|
+
const player = source ? playerOf(source) : null
|
|
21
|
+
const poster = entry.hero ? safeSrc(entry.hero.url) : null
|
|
22
|
+
const description = entry.body?.markdown ? renderMarkdown(entry.body.markdown) : ''
|
|
23
|
+
---
|
|
24
|
+
<article class="entry entry-watch">
|
|
25
|
+
<div class="watch-frame">
|
|
26
|
+
{player && <iframe src={player} title={entry.title} allow="encrypted-media; picture-in-picture; fullscreen" allowfullscreen></iframe>}
|
|
27
|
+
{source && !player && (
|
|
28
|
+
<video src={source} poster={poster ?? undefined} controls preload="none" playsinline>
|
|
29
|
+
<a href={source} rel={relFor(source)}>Watch the video</a>
|
|
30
|
+
</video>
|
|
31
|
+
)}
|
|
32
|
+
{!source && <p class="watch-missing">The video for this page is not up yet.</p>}
|
|
33
|
+
</div>
|
|
34
|
+
<div class="watch-text">
|
|
35
|
+
<EntryHeader entry={entry} type={type} kicker={type?.singular_label ?? 'Video'} />
|
|
36
|
+
{description && <div class="prose entry-body" set:html={description} />}
|
|
37
|
+
<EntryFields entry={entry} type={type} />
|
|
38
|
+
{entry.url && <Share title={entry.title} path={entry.url} />}
|
|
39
|
+
<AuthorBox authors={entry.authors} />
|
|
40
|
+
</div>
|
|
41
|
+
</article>
|