@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.
Files changed (349) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +12 -2
  3. package/dist/chunk-RJAVFRC6.js +67 -0
  4. package/dist/constants-BAIo_Q5U.d-lQbj1e1-.d.ts +48 -0
  5. package/dist/content-api-Cox1-wz5.d.ts +1096 -0
  6. package/dist/contract/content-api-examples.d.ts +72 -0
  7. package/dist/contract/content-api-examples.js +926 -0
  8. package/dist/contract/content-api.d.ts +2 -0
  9. package/dist/contract/content-api.js +1 -0
  10. package/dist/contract/site-templates.d.ts +253 -0
  11. package/dist/contract/site-templates.js +185 -0
  12. package/package.json +70 -3
  13. package/src/components/EntryCard.astro +35 -0
  14. package/src/components/EventMap.astro +118 -0
  15. package/src/components/EventPage.astro +194 -0
  16. package/src/components/FieldValue.astro +41 -0
  17. package/src/components/LeadingHero.astro +21 -0
  18. package/src/components/NotFound.astro +20 -0
  19. package/src/components/PageSections.astro +47 -0
  20. package/src/components/Prose.astro +18 -0
  21. package/src/components/chrome/Brand.astro +61 -0
  22. package/src/components/chrome/ClosingCall.astro +94 -0
  23. package/src/components/chrome/DonateStrip.astro +61 -0
  24. package/src/components/chrome/FooterColumns.astro +32 -0
  25. package/src/components/chrome/FooterContact.astro +28 -0
  26. package/src/components/chrome/MenuList.astro +45 -0
  27. package/src/components/chrome/ModeToggle.astro +125 -0
  28. package/src/components/chrome/SignedInNotice.astro +53 -0
  29. package/src/components/chrome/SignupBand.astro +12 -0
  30. package/src/components/chrome/TakeoverBanner.astro +56 -0
  31. package/src/components/chrome/VisitorAccount.astro +82 -0
  32. package/src/components/entries/AuthorBox.astro +47 -0
  33. package/src/components/entries/EntryFields.astro +29 -0
  34. package/src/components/entries/EntryHeader.astro +77 -0
  35. package/src/components/entries/ListFrame.astro +126 -0
  36. package/src/components/entries/ListSearch.astro +24 -0
  37. package/src/components/entries/Share.astro +24 -0
  38. package/src/components/entries/course/classroom.astro +26 -0
  39. package/src/components/entries/course/lesson.astro +18 -0
  40. package/src/components/entries/course/section.ts +20 -0
  41. package/src/components/entries/course/syllabus.astro +15 -0
  42. package/src/components/entries/index.ts +77 -0
  43. package/src/components/entries/newsletter/issue.astro +41 -0
  44. package/src/components/entries/newsletter/list.astro +26 -0
  45. package/src/components/entries/podcast/episode.astro +42 -0
  46. package/src/components/entries/podcast/list.astro +36 -0
  47. package/src/components/entries/post/article.astro +31 -0
  48. package/src/components/entries/post/list.astro +85 -0
  49. package/src/components/entries/props.ts +61 -0
  50. package/src/components/entries/video/cards.astro +39 -0
  51. package/src/components/entries/video/grid.astro +15 -0
  52. package/src/components/entries/video/watch.astro +41 -0
  53. package/src/components/live/LivePage.astro +215 -0
  54. package/src/components/live/LocalTime.astro +29 -0
  55. package/src/components/sections/About/books.astro +188 -0
  56. package/src/components/sections/About/credentials.ts +80 -0
  57. package/src/components/sections/About/index.astro +60 -0
  58. package/src/components/sections/About/left.astro +57 -0
  59. package/src/components/sections/About/letter.astro +111 -0
  60. package/src/components/sections/About/portrait.astro +308 -0
  61. package/src/components/sections/Advocacy/compact.astro +14 -0
  62. package/src/components/sections/Advocacy/index.astro +14 -0
  63. package/src/components/sections/Band.astro +39 -0
  64. package/src/components/sections/Blog/feature.astro +176 -0
  65. package/src/components/sections/Blog/index.astro +37 -0
  66. package/src/components/sections/Blog/latest.ts +80 -0
  67. package/src/components/sections/Blog/list.astro +186 -0
  68. package/src/components/sections/Booking/index.astro +139 -0
  69. package/src/components/sections/Booking/list.astro +144 -0
  70. package/src/components/sections/Booking/types.ts +60 -0
  71. package/src/components/sections/Calendar/agenda.astro +14 -0
  72. package/src/components/sections/Calendar/index.astro +14 -0
  73. package/src/components/sections/CandidateRoster/ballot.astro +394 -0
  74. package/src/components/sections/CandidateRoster/candidates.ts +69 -0
  75. package/src/components/sections/CandidateRoster/compact.astro +115 -0
  76. package/src/components/sections/CandidateRoster/index.astro +57 -0
  77. package/src/components/sections/CaseStudies/beforeafter.astro +222 -0
  78. package/src/components/sections/CaseStudies/cases.ts +111 -0
  79. package/src/components/sections/CaseStudies/grid.astro +261 -0
  80. package/src/components/sections/CaseStudies/index.astro +333 -0
  81. package/src/components/sections/Classroom/CourseCard.astro +181 -0
  82. package/src/components/sections/Classroom/Courses.astro +88 -0
  83. package/src/components/sections/Classroom/classroom.ts +141 -0
  84. package/src/components/sections/Classroom/index.astro +20 -0
  85. package/src/components/sections/Classroom/list.astro +15 -0
  86. package/src/components/sections/Collection/compact.astro +7 -0
  87. package/src/components/sections/Collection/entries.ts +62 -0
  88. package/src/components/sections/Collection/feature.astro +180 -0
  89. package/src/components/sections/Collection/index.astro +46 -0
  90. package/src/components/sections/Collection/library.astro +271 -0
  91. package/src/components/sections/Collection/list.astro +7 -0
  92. package/src/components/sections/Collection/outline.astro +134 -0
  93. package/src/components/sections/Collection/shelves.astro +191 -0
  94. package/src/components/sections/Comparison/Unlisted.astro +6 -0
  95. package/src/components/sections/Comparison/cards.astro +171 -0
  96. package/src/components/sections/Comparison/index.astro +191 -0
  97. package/src/components/sections/Comparison/sides.ts +98 -0
  98. package/src/components/sections/Comparison/spectrum.astro +261 -0
  99. package/src/components/sections/ContentPost/banner.astro +152 -0
  100. package/src/components/sections/ContentPost/index.astro +35 -0
  101. package/src/components/sections/ContentPost/lesson.ts +126 -0
  102. package/src/components/sections/ContentPost/player.astro +254 -0
  103. package/src/components/sections/ContentPost/prose.astro +80 -0
  104. package/src/components/sections/ContentPost/theater.astro +329 -0
  105. package/src/components/sections/Countdown/index.astro +53 -0
  106. package/src/components/sections/Course/Bar.astro +46 -0
  107. package/src/components/sections/Course/CourseHead.astro +123 -0
  108. package/src/components/sections/Course/Crumbs.astro +44 -0
  109. package/src/components/sections/Course/Icon.astro +29 -0
  110. package/src/components/sections/Course/Ring.astro +62 -0
  111. package/src/components/sections/Course/Syllabus.astro +146 -0
  112. package/src/components/sections/Course/course.ts +146 -0
  113. package/src/components/sections/Course/index.astro +143 -0
  114. package/src/components/sections/Course/outline.astro +39 -0
  115. package/src/components/sections/Cta/banner.astro +64 -0
  116. package/src/components/sections/Cta/card.astro +88 -0
  117. package/src/components/sections/Cta/index.astro +31 -0
  118. package/src/components/sections/Cta/photo.astro +114 -0
  119. package/src/components/sections/Cta/strip.astro +91 -0
  120. package/src/components/sections/Donate/index.astro +136 -0
  121. package/src/components/sections/Donate/story.astro +7 -0
  122. package/src/components/sections/Event/card.astro +14 -0
  123. package/src/components/sections/Event/index.astro +14 -0
  124. package/src/components/sections/EventsList/AgendaMonths.astro +105 -0
  125. package/src/components/sections/EventsList/CalendarLine.astro +23 -0
  126. package/src/components/sections/EventsList/EventRows.astro +196 -0
  127. package/src/components/sections/EventsList/LiveCounts.astro +75 -0
  128. package/src/components/sections/EventsList/TypeTabs.astro +53 -0
  129. package/src/components/sections/EventsList/agenda.astro +55 -0
  130. package/src/components/sections/EventsList/calendar.astro +392 -0
  131. package/src/components/sections/EventsList/cards.astro +186 -0
  132. package/src/components/sections/EventsList/cohorts.astro +205 -0
  133. package/src/components/sections/EventsList/compact.astro +163 -0
  134. package/src/components/sections/EventsList/events.ts +168 -0
  135. package/src/components/sections/EventsList/index.astro +46 -0
  136. package/src/components/sections/EventsList/map.astro +436 -0
  137. package/src/components/sections/EventsList/shifts.astro +355 -0
  138. package/src/components/sections/EventsList/week.astro +361 -0
  139. package/src/components/sections/Faq/Contact.astro +63 -0
  140. package/src/components/sections/Faq/Questions.astro +98 -0
  141. package/src/components/sections/Faq/cards.astro +74 -0
  142. package/src/components/sections/Faq/faq.ts +101 -0
  143. package/src/components/sections/Faq/index.astro +49 -0
  144. package/src/components/sections/Faq/topics.astro +178 -0
  145. package/src/components/sections/Financials/Foot.astro +38 -0
  146. package/src/components/sections/Financials/Head.astro +47 -0
  147. package/src/components/sections/Financials/donut.astro +197 -0
  148. package/src/components/sections/Financials/financials.ts +52 -0
  149. package/src/components/sections/Financials/index.astro +148 -0
  150. package/src/components/sections/Financials/table.astro +157 -0
  151. package/src/components/sections/FormBlock/index.astro +33 -0
  152. package/src/components/sections/FormBlock/wide.astro +7 -0
  153. package/src/components/sections/Hero/cover.astro +176 -0
  154. package/src/components/sections/Hero/donate.astro +209 -0
  155. package/src/components/sections/Hero/field.astro +390 -0
  156. package/src/components/sections/Hero/index.astro +52 -0
  157. package/src/components/sections/Hero/overlap.astro +151 -0
  158. package/src/components/sections/Hero/rotating.astro +30 -0
  159. package/src/components/sections/Hero/split.astro +99 -0
  160. package/src/components/sections/Hero/statement.astro +55 -0
  161. package/src/components/sections/Hero/video.astro +399 -0
  162. package/src/components/sections/Issues/checklist.astro +204 -0
  163. package/src/components/sections/Issues/drawer.astro +237 -0
  164. package/src/components/sections/Issues/index.astro +115 -0
  165. package/src/components/sections/Issues/issues.ts +37 -0
  166. package/src/components/sections/Issues/numbered.astro +79 -0
  167. package/src/components/sections/Issues/rows.astro +137 -0
  168. package/src/components/sections/Issues/steps.astro +81 -0
  169. package/src/components/sections/Issues/tabs.astro +322 -0
  170. package/src/components/sections/Leaderboard/index.astro +29 -0
  171. package/src/components/sections/Lesson/Door.astro +121 -0
  172. package/src/components/sections/Lesson/LessonBody.astro +416 -0
  173. package/src/components/sections/Lesson/Rail.astro +182 -0
  174. package/src/components/sections/Lesson/Tracker.astro +137 -0
  175. package/src/components/sections/Lesson/index.astro +27 -0
  176. package/src/components/sections/Lesson/lesson.ts +233 -0
  177. package/src/components/sections/Lesson/reading.astro +21 -0
  178. package/src/components/sections/Map/CoverageLine.astro +19 -0
  179. package/src/components/sections/Map/RegionMap.astro +109 -0
  180. package/src/components/sections/Map/bar.astro +160 -0
  181. package/src/components/sections/Map/index.astro +192 -0
  182. package/src/components/sections/Map/map.astro +275 -0
  183. package/src/components/sections/MediaKit/BioCard.astro +108 -0
  184. package/src/components/sections/MediaKit/Downloads.astro +88 -0
  185. package/src/components/sections/MediaKit/index.astro +183 -0
  186. package/src/components/sections/MediaKit/kit.ts +140 -0
  187. package/src/components/sections/MediaKit/press.astro +189 -0
  188. package/src/components/sections/MediaKit/speaker.astro +205 -0
  189. package/src/components/sections/Membership/Benefits.astro +42 -0
  190. package/src/components/sections/Membership/Check.astro +12 -0
  191. package/src/components/sections/Membership/Price.astro +61 -0
  192. package/src/components/sections/Membership/compare.astro +312 -0
  193. package/src/components/sections/Membership/index.astro +281 -0
  194. package/src/components/sections/Membership/offers.ts +169 -0
  195. package/src/components/sections/Membership/tiers.astro +217 -0
  196. package/src/components/sections/MovementMap/index.astro +50 -0
  197. package/src/components/sections/MovementTicker/index.astro +43 -0
  198. package/src/components/sections/Pathways/Doors.astro +147 -0
  199. package/src/components/sections/Pathways/Head.astro +37 -0
  200. package/src/components/sections/Pathways/index.astro +27 -0
  201. package/src/components/sections/Pathways/pathways.ts +100 -0
  202. package/src/components/sections/Pathways/quiz.astro +286 -0
  203. package/src/components/sections/Pathways/tabs.astro +271 -0
  204. package/src/components/sections/PdfEmbed/card.astro +99 -0
  205. package/src/components/sections/PdfEmbed/index.astro +26 -0
  206. package/src/components/sections/PdfEmbed/medium.astro +7 -0
  207. package/src/components/sections/PdfEmbed/tall.astro +7 -0
  208. package/src/components/sections/Petition/coverage.astro +14 -0
  209. package/src/components/sections/Petition/image.astro +14 -0
  210. package/src/components/sections/Petition/index.astro +14 -0
  211. package/src/components/sections/Petition/map.astro +14 -0
  212. package/src/components/sections/PlatformPlanks/anchors.ts +66 -0
  213. package/src/components/sections/PlatformPlanks/columns.astro +171 -0
  214. package/src/components/sections/PlatformPlanks/index.astro +56 -0
  215. package/src/components/sections/PlatformPlanks/longread.astro +250 -0
  216. package/src/components/sections/PollBlock/index.astro +30 -0
  217. package/src/components/sections/Portfolio/featured.astro +343 -0
  218. package/src/components/sections/Portfolio/index.astro +571 -0
  219. package/src/components/sections/Portfolio/strip.astro +173 -0
  220. package/src/components/sections/Portfolio/work.ts +100 -0
  221. package/src/components/sections/Progress/MatchClock.astro +166 -0
  222. package/src/components/sections/Progress/compact.astro +150 -0
  223. package/src/components/sections/Progress/index.astro +32 -0
  224. package/src/components/sections/Progress/match.astro +126 -0
  225. package/src/components/sections/Progress/ring.astro +179 -0
  226. package/src/components/sections/QuickDonate/DonateCard.astro +149 -0
  227. package/src/components/sections/QuickDonate/Picker.astro +95 -0
  228. package/src/components/sections/QuickDonate/band.astro +164 -0
  229. package/src/components/sections/QuickDonate/bar.astro +208 -0
  230. package/src/components/sections/QuickDonate/donate.ts +126 -0
  231. package/src/components/sections/QuickDonate/hero.astro +143 -0
  232. package/src/components/sections/QuickDonate/index.astro +73 -0
  233. package/src/components/sections/QuickDonate/jar.astro +225 -0
  234. package/src/components/sections/QuickDonate/ladder.astro +248 -0
  235. package/src/components/sections/QuoteStrip/carousel.astro +340 -0
  236. package/src/components/sections/QuoteStrip/index.astro +58 -0
  237. package/src/components/sections/QuoteStrip/logos.astro +226 -0
  238. package/src/components/sections/QuoteStrip/quotes.ts +61 -0
  239. package/src/components/sections/QuoteStrip/single.astro +92 -0
  240. package/src/components/sections/QuoteStrip/ticker.astro +319 -0
  241. package/src/components/sections/QuoteStrip/wall.astro +113 -0
  242. package/src/components/sections/Resources/band.astro +93 -0
  243. package/src/components/sections/Resources/featured.astro +239 -0
  244. package/src/components/sections/Resources/index.astro +225 -0
  245. package/src/components/sections/Resources/resources.ts +92 -0
  246. package/src/components/sections/SampleBallot/Position.astro +39 -0
  247. package/src/components/sections/SampleBallot/ballot.ts +92 -0
  248. package/src/components/sections/SampleBallot/cards.astro +299 -0
  249. package/src/components/sections/SampleBallot/index.astro +326 -0
  250. package/src/components/sections/SampleBallot/measures.astro +172 -0
  251. package/src/components/sections/Scorecard/grades.astro +141 -0
  252. package/src/components/sections/Scorecard/index.astro +294 -0
  253. package/src/components/sections/Scorecard/promise.astro +167 -0
  254. package/src/components/sections/Scorecard/votes.ts +83 -0
  255. package/src/components/sections/SectionHead.astro +31 -0
  256. package/src/components/sections/Services/Button.astro +24 -0
  257. package/src/components/sections/Services/Check.astro +12 -0
  258. package/src/components/sections/Services/Includes.astro +42 -0
  259. package/src/components/sections/Services/compare.astro +328 -0
  260. package/src/components/sections/Services/index.astro +187 -0
  261. package/src/components/sections/Services/list.astro +181 -0
  262. package/src/components/sections/Services/services.ts +80 -0
  263. package/src/components/sections/ShareKit/Actions.astro +71 -0
  264. package/src/components/sections/ShareKit/Buttons.astro +62 -0
  265. package/src/components/sections/ShareKit/compact.astro +123 -0
  266. package/src/components/sections/ShareKit/index.astro +160 -0
  267. package/src/components/sections/ShareKit/share.ts +60 -0
  268. package/src/components/sections/ShareKit/strip.astro +173 -0
  269. package/src/components/sections/SignupCapture/band.astro +7 -0
  270. package/src/components/sections/SignupCapture/index.astro +103 -0
  271. package/src/components/sections/SignupCapture/inline.astro +7 -0
  272. package/src/components/sections/SocialFeed/index.astro +34 -0
  273. package/src/components/sections/StatCards/feature.astro +143 -0
  274. package/src/components/sections/StatCards/index.astro +51 -0
  275. package/src/components/sections/StatCards/ribbon.astro +113 -0
  276. package/src/components/sections/StatCards/wall.astro +177 -0
  277. package/src/components/sections/Store/featured.astro +14 -0
  278. package/src/components/sections/Store/index.astro +14 -0
  279. package/src/components/sections/Stories/Status.astro +42 -0
  280. package/src/components/sections/Stories/StoryCards.astro +171 -0
  281. package/src/components/sections/Stories/cards.astro +42 -0
  282. package/src/components/sections/Stories/index.astro +238 -0
  283. package/src/components/sections/Stories/stories.ts +97 -0
  284. package/src/components/sections/Stories/timeline.astro +135 -0
  285. package/src/components/sections/TeamGrid/board.astro +280 -0
  286. package/src/components/sections/TeamGrid/index.astro +71 -0
  287. package/src/components/sections/TeamGrid/list.astro +306 -0
  288. package/src/components/sections/TeamGrid/people.ts +178 -0
  289. package/src/components/sections/VideoEmbed/index.astro +52 -0
  290. package/src/components/sections/VideoEmbed/landscape.astro +7 -0
  291. package/src/components/sections/VideoEmbed/portrait.astro +7 -0
  292. package/src/components/sections/VideoEmbed/square.astro +7 -0
  293. package/src/components/sections/VoterTools/DaysLeft.astro +33 -0
  294. package/src/components/sections/VoterTools/Lookup.astro +43 -0
  295. package/src/components/sections/VoterTools/dates.astro +153 -0
  296. package/src/components/sections/VoterTools/index.astro +231 -0
  297. package/src/components/sections/VoterTools/polling.astro +144 -0
  298. package/src/components/sections/VoterTools/voter-tools.ts +71 -0
  299. package/src/components/sections/index.ts +373 -0
  300. package/src/components/sections/modules/Headed.astro +39 -0
  301. package/src/components/sections/modules/ModuleFrame.astro +181 -0
  302. package/src/components/store/CollectionPage.astro +40 -0
  303. package/src/components/store/ProductCard.astro +32 -0
  304. package/src/components/store/ProductGrid.astro +16 -0
  305. package/src/components/store/ProductPage.astro +146 -0
  306. package/src/components/store/StorePage.astro +137 -0
  307. package/src/components/store/StoreScript.astro +572 -0
  308. package/src/components/volunteer/ShiftLive.astro +90 -0
  309. package/src/components/volunteer/detail.astro +247 -0
  310. package/src/components/volunteer/list.astro +298 -0
  311. package/src/components/volunteer/props.ts +21 -0
  312. package/src/env.d.ts +22 -0
  313. package/src/index.d.ts +10 -0
  314. package/src/index.js +63 -0
  315. package/src/layouts/Site.astro +387 -0
  316. package/src/lib/academy.ts +146 -0
  317. package/src/lib/brand.ts +534 -0
  318. package/src/lib/chrome.ts +121 -0
  319. package/src/lib/donate-frame.ts +104 -0
  320. package/src/lib/entries.ts +190 -0
  321. package/src/lib/env.ts +34 -0
  322. package/src/lib/event-map-draw.ts +91 -0
  323. package/src/lib/events.ts +476 -0
  324. package/src/lib/fonts.ts +116 -0
  325. package/src/lib/footer.ts +24 -0
  326. package/src/lib/format.ts +160 -0
  327. package/src/lib/geo.ts +131 -0
  328. package/src/lib/live.ts +55 -0
  329. package/src/lib/menu.ts +48 -0
  330. package/src/lib/petition-text.ts +29 -0
  331. package/src/lib/reading.ts +17 -0
  332. package/src/lib/regions.ts +215 -0
  333. package/src/lib/section.ts +105 -0
  334. package/src/lib/shifts.ts +187 -0
  335. package/src/lib/store.ts +521 -0
  336. package/src/lib/stream-time.ts +20 -0
  337. package/src/lib/stream.ts +141 -0
  338. package/src/lib/visitor.ts +54 -0
  339. package/src/routes/catch-all.astro +435 -0
  340. package/src/routes/form.astro +30 -0
  341. package/src/routes/live.astro +49 -0
  342. package/src/routes/not-found.astro +18 -0
  343. package/src/routes/preview.astro +60 -0
  344. package/src/routes/setup.astro +62 -0
  345. package/src/routes/volunteer-shift.astro +61 -0
  346. package/src/styles/entries.css +784 -0
  347. package/src/styles/site.css +1910 -0
  348. package/src/styles/store.css +634 -0
  349. package/src/template.ts +182 -0
@@ -0,0 +1,37 @@
1
+ ---
2
+ // Blog (Cards, the default): the newest posts. The section carries no rows of
3
+ // its own, so it reads the newest entries of the blog types (posts, podcasts,
4
+ // videos: every type the news list shows), three or the section's
5
+ // `maxItems`. Over them the section head (C1's Blog · cards): the kicker when
6
+ // one is set, the heading and its "All news" link (the section's own link,
7
+ // else "All news" to the news list at the organization's blog base), as Lead
8
+ // story draws it.
9
+ import type { Section } from '@backgold/content'
10
+ import Band from '../Band.astro'
11
+ import EntryCard from '../../EntryCard.astro'
12
+ import SectionHead from '../SectionHead.astro'
13
+ import { entryCard, links } from '../../../lib/section'
14
+ import { text } from '../../../lib/format'
15
+ import { latestNews, shownOf } from './latest'
16
+
17
+ interface Props {
18
+ section: Section
19
+ variant?: string
20
+ }
21
+
22
+ const { section } = Astro.props
23
+ const heading = text(section.copy.heading) ?? 'Latest'
24
+ const own = links(section)
25
+ const { entries, listPath } = await latestNews(Astro.locals, shownOf(section, 3))
26
+ const more = entries.length === 0 ? [] : own.length > 0 ? own : listPath ? [{ label: 'All news', href: listPath, rel: undefined }] : []
27
+ ---
28
+ <Band section={section} class="entries">
29
+ <SectionHead kicker={text(section.copy.kicker)} heading={heading} more={more} />
30
+ {entries.length > 0 ? (
31
+ <div class="grid grid-3">
32
+ {entries.map((entry) => <EntryCard card={entryCard(entry)} level={3} />)}
33
+ </div>
34
+ ) : (
35
+ <p class="empty">Nothing published yet.</p>
36
+ )}
37
+ </Band>
@@ -0,0 +1,80 @@
1
+ // What every Blog layout lists: the newest entries of the blog types (posts,
2
+ // podcasts, videos: the types the news list shows together at the
3
+ // organization's blog base, never one with an address of its own like the
4
+ // newsletter), newest first, and that list's address for its "All news"
5
+ // link. The section carries no rows of its own; its `maxItems` caps the
6
+ // count, else the layout's own number. On an entry's page (a Blog section in
7
+ // its sidebar, board C11) the entry being read is left out.
8
+
9
+ import type { Entry, Section } from '@backgold/content'
10
+ import { blogBaseOf, isBlogType, safeHref, safeSrc } from '@backgold/astro/server'
11
+ import { basePath } from '../../../lib/entries'
12
+ import { readingOf } from '../../../lib/reading'
13
+ import { formatDay, formatShortDay, listOf } from '../../../lib/format'
14
+ import { initials } from '../CandidateRoster/candidates'
15
+
16
+ /** The section's `maxItems` when set, else `fallback`. */
17
+ export function shownOf(section: Section, fallback: number): number {
18
+ const max = section.options?.maxItems
19
+ return typeof max === 'number' && Number.isFinite(max) && max > 0 ? Math.floor(max) : fallback
20
+ }
21
+
22
+ /**
23
+ * The newest `count` entries of the blog types but the one this request is
24
+ * reading (`readingOf`), and the news list's path (null on a site with no
25
+ * blog type).
26
+ */
27
+ export async function latestNews(locals: App.Locals, count: number): Promise<{ entries: Entry[]; listPath: string | null }> {
28
+ const bg = locals.backgold
29
+ if (bg.setup !== null) return { entries: [], listPath: null }
30
+ const reading = readingOf(locals)
31
+ const { types } = await bg.client.types()
32
+ const base = blogBaseOf(types)
33
+ // One more than shown when an entry is being read: it may be among the newest.
34
+ const limit = reading === null ? count : count + 1
35
+ const lists = await Promise.all(types.filter(isBlogType).map((t) => bg.client.entries(t.key, { limit })))
36
+ const entries = lists
37
+ .flatMap((list) => list?.entries ?? [])
38
+ .filter((entry) => entry.id !== reading)
39
+ .sort((a, b) => (b.publish_at ?? '').localeCompare(a.publish_at ?? ''))
40
+ .slice(0, count)
41
+ return { entries, listPath: base === null ? null : basePath(base) }
42
+ }
43
+
44
+ /** One post as the Lead story and List layouts draw it. */
45
+ interface Story {
46
+ title: string
47
+ href: string | null
48
+ summary: string | null
49
+ /** The cover, decorative: the title beside it says what the post is. */
50
+ image: string | null
51
+ /** The post's category (its first term, a `category` term first). */
52
+ category: string | null
53
+ date: string | null
54
+ day: string | null
55
+ /** "Oct 2", the date as the Lead story's bylines show it. */
56
+ shortDay: string | null
57
+ /** "A and B", the post's authors. */
58
+ byline: string | null
59
+ /** The first author's picture, else their initials ("CP"); null without an author. */
60
+ avatar: { url: string | null; initials: string } | null
61
+ }
62
+
63
+ export function storyOf(entry: Entry): Story {
64
+ const category = entry.terms.find((t) => t.taxonomy === 'category') ?? entry.terms[0]
65
+ const named = entry.authors.filter((a) => a.display_name && a.display_name.trim() !== '')
66
+ const authors = named.map((a) => a.display_name)
67
+ const first = named[0]
68
+ return {
69
+ title: entry.title,
70
+ href: entry.url ? safeHref(entry.url) : null,
71
+ summary: entry.summary,
72
+ image: entry.hero ? safeSrc(entry.hero.url) : null,
73
+ category: category?.label ?? null,
74
+ date: entry.publish_at,
75
+ day: formatDay(entry.publish_at),
76
+ shortDay: formatShortDay(entry.publish_at),
77
+ byline: authors.length > 0 ? listOf(authors) : null,
78
+ avatar: first ? { url: safeSrc(first.avatar_url), initials: initials(first.display_name) } : null,
79
+ }
80
+ }
@@ -0,0 +1,186 @@
1
+ ---
2
+ // Blog · List (board A4, "Blog · List"; A12 shows it beside Cards and Lead
3
+ // story): one post per row, newest first, with its cover, category, title,
4
+ // summary and byline (authors · date). Four posts, or the section's
5
+ // `maxItems`; "All news" goes to the full list at the organization's blog
6
+ // base. The board's category tabs, search and pager belong to that list, not
7
+ // to the section, and are not drawn here. With nothing published it draws
8
+ // nothing. It lays out by its own width, not the screen's: the cover beside
9
+ // the words where the list is 40rem or wider, over them where it is not. In
10
+ // a sidebar (board C11's More from the campaign) each row is the category,
11
+ // the title and the short date ("Sep 30"), with no author, and a small square
12
+ // cover after the words; on an entry's page the entry being read is left out
13
+ // (latest.ts). Its classes are its own (`blog-`): the news list's rows in
14
+ // entries.css are drawn differently.
15
+ import type { ComponentProps } from 'astro/types'
16
+ import type Default from './index.astro'
17
+ import Band from '../Band.astro'
18
+ import { text } from '../../../lib/format'
19
+ import { latestNews, shownOf, storyOf } from './latest'
20
+
21
+ type Props = ComponentProps<typeof Default>
22
+
23
+ const { section } = Astro.props
24
+ const heading = text(section.copy.heading) ?? 'Latest'
25
+ const { entries, listPath } = await latestNews(Astro.locals, shownOf(section, 4))
26
+ const stories = entries.map(storyOf)
27
+ ---
28
+ {stories.length > 0 && (
29
+ <Band section={section} class="entries blog-list">
30
+ <h2>{heading}</h2>
31
+ <ul class="blog-rows" role="list">
32
+ {stories.map((story) => (
33
+ <li class:list={['blog-row', { 'blog-row-pictured': story.image }]}>
34
+ {story.image && <span class="blog-frame"><img class="blog-cover" src={story.image} alt="" loading="lazy" decoding="async" /></span>}
35
+ <div class="blog-body">
36
+ {story.category && <p class="blog-chip">{story.category}</p>}
37
+ <h3 class="blog-title">{story.href ? <a href={story.href}>{story.title}</a> : story.title}</h3>
38
+ {story.summary && <p class="blog-summary">{story.summary}</p>}
39
+ {(story.byline || story.day) && (
40
+ <p class="blog-meta">
41
+ {story.byline && <span class="blog-by">{story.byline}{story.day && ' · '}</span>}
42
+ {story.day && story.date && (
43
+ <time datetime={story.date}><span class="blog-day">{story.day}</span><span class="blog-day-short">{story.shortDay}</span></time>
44
+ )}
45
+ </p>
46
+ )}
47
+ </div>
48
+ </li>
49
+ ))}
50
+ </ul>
51
+ {listPath && <p class="more"><a href={listPath}>All news</a></p>}
52
+ </Band>
53
+ )}
54
+
55
+ <style>
56
+ .blog-rows {
57
+ container-type: inline-size;
58
+ margin: 1.5rem 0 0;
59
+ padding: 0;
60
+ list-style: none;
61
+ }
62
+ .blog-row {
63
+ display: grid;
64
+ gap: 0.875rem;
65
+ padding: 1.5rem 0;
66
+ border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
67
+ }
68
+ .blog-row:first-child {
69
+ border-top: 0;
70
+ padding-top: 0;
71
+ }
72
+ .blog-frame {
73
+ display: block;
74
+ overflow: hidden;
75
+ border-radius: var(--radius);
76
+ }
77
+ .blog-cover {
78
+ display: block;
79
+ width: 100%;
80
+ aspect-ratio: 4 / 3;
81
+ object-fit: cover;
82
+ }
83
+ .blog-body > * {
84
+ margin: 0;
85
+ }
86
+ .blog-chip {
87
+ display: inline-block;
88
+ padding: 0.125rem 0.625rem;
89
+ border-radius: var(--pill);
90
+ background: color-mix(in srgb, var(--link) 12%, transparent);
91
+ color: var(--ink);
92
+ font-size: var(--text-xs);
93
+ font-weight: 700;
94
+ letter-spacing: 0.04em;
95
+ }
96
+ .blog-body .blog-title {
97
+ margin-top: 0.5rem;
98
+ font-size: var(--h3);
99
+ font-weight: 700;
100
+ line-height: 1.2;
101
+ }
102
+ .blog-title a {
103
+ color: var(--ink);
104
+ text-decoration: none;
105
+ }
106
+ .blog-title a:hover {
107
+ text-decoration: underline;
108
+ }
109
+ .blog-body .blog-summary {
110
+ margin-top: 0.5rem;
111
+ color: var(--muted);
112
+ max-width: var(--measure);
113
+ }
114
+ .blog-body .blog-meta {
115
+ margin-top: 0.625rem;
116
+ color: var(--muted);
117
+ font-size: var(--text-sm);
118
+ }
119
+ .blog-day-short {
120
+ display: none;
121
+ }
122
+ @container (min-width: 40rem) {
123
+ .blog-row-pictured {
124
+ grid-template-columns: minmax(10rem, 13.75rem) minmax(0, 1fr);
125
+ gap: 1.5rem;
126
+ }
127
+ }
128
+ /* In a sidebar (C11): compact rows of the category, the title and the short date, a small square cover after the words. */
129
+ :global(.rail) .blog-rows {
130
+ margin-top: 1rem;
131
+ }
132
+ :global(.rail) .blog-row {
133
+ padding: 0.75rem 0;
134
+ border-top-color: var(--line);
135
+ }
136
+ :global(.rail) .blog-row:first-child {
137
+ padding-top: 0.125rem;
138
+ }
139
+ :global(.rail) .blog-row-pictured {
140
+ grid-template-columns: minmax(0, 1fr) 4.5rem;
141
+ gap: 0.875rem;
142
+ align-items: center;
143
+ }
144
+ :global(.rail) .blog-row-pictured .blog-frame {
145
+ grid-column: 2;
146
+ grid-row: 1;
147
+ border-radius: 0.625rem;
148
+ }
149
+ :global(.rail) .blog-row-pictured .blog-body {
150
+ grid-column: 1;
151
+ grid-row: 1;
152
+ }
153
+ :global(.rail) .blog-cover {
154
+ aspect-ratio: 1;
155
+ }
156
+ :global(.rail) .blog-chip {
157
+ padding: 0.125rem 0.5rem;
158
+ font-size: 0.6875rem;
159
+ }
160
+ :global(.rail) .blog-body .blog-title {
161
+ margin-top: 0.375rem;
162
+ font-size: 1.1875rem;
163
+ line-height: 1.12;
164
+ text-wrap: balance;
165
+ }
166
+ :global(.rail) .blog-body .blog-summary,
167
+ :global(.rail) .blog-by,
168
+ :global(.rail) .blog-day {
169
+ display: none;
170
+ }
171
+ :global(.rail) .blog-day-short {
172
+ display: inline;
173
+ }
174
+ :global(.rail) .blog-body .blog-meta {
175
+ margin-top: 0.25rem;
176
+ font-size: 0.78125rem;
177
+ }
178
+ @media (prefers-reduced-motion: no-preference) {
179
+ .blog-cover {
180
+ transition: transform 0.3s ease;
181
+ }
182
+ .blog-row:hover .blog-cover {
183
+ transform: scale(1.02);
184
+ }
185
+ }
186
+ </style>
@@ -0,0 +1,139 @@
1
+ ---
2
+ // Booking, 'cards' layout, the default (board S05, B, "Meeting-type cards"):
3
+ // the section head and the body, then a card per meeting type the
4
+ // organization's booking module offers, in its order, three across (two on a
5
+ // tablet, one under another on a phone), each on the band's surface under a
6
+ // thin rule in the accent: the type's name, its description, a line with its
7
+ // length and where it happens ("30 min · Video call"), then at the foot its
8
+ // price in the display face ("$250", "Free"; nothing when the type names no
9
+ // price) beside the pick button ("Pick a time", the section's pick label) to
10
+ // the type's booking page in BackGold, where the time is picked and the
11
+ // booking made. The first card's button is solid and the rest are outlined, so
12
+ // the section has one dominant action. A single type draws one card, centred.
13
+ //
14
+ // Nothing is drawn when the organization offers no meeting types, heading or
15
+ // not: the words would promise a booking that does not exist.
16
+ import type { Section } from '@backgold/content'
17
+ import Band from '../Band.astro'
18
+ import SectionHead from '../SectionHead.astro'
19
+ import Prose from '../../Prose.astro'
20
+ import { meetingTypesOf } from './types'
21
+ import { text } from '../../../lib/format'
22
+
23
+ interface Props {
24
+ section: Section
25
+ variant?: string
26
+ }
27
+
28
+ const { section } = Astro.props
29
+ const types = meetingTypesOf(section)
30
+ ---
31
+ {types.length > 0 && (
32
+ <Band section={section} class="booking booking-cards">
33
+ <SectionHead kicker={text(section.copy.kicker)} heading={text(section.copy.heading)} more={[]} />
34
+ <Prose value={section.copy.body} class="lede" />
35
+ <ul class="bk-cards" role="list" data-count={Math.min(types.length, 3)}>
36
+ {types.map((type, i) => (
37
+ <li class="bk-card">
38
+ <div class="bk-card-body">
39
+ <h3 class="bk-name">{type.name}</h3>
40
+ {type.description && <p class="bk-description">{type.description}</p>}
41
+ {type.meta && <p class="bk-meta">{type.meta}</p>}
42
+ </div>
43
+ <div class="bk-foot">
44
+ {type.price && <p class="bk-price">{type.price}</p>}
45
+ <a class:list={['button', 'bk-pick', i > 0 && 'button-quiet']} href={type.book.href} rel={type.book.rel}>
46
+ {type.book.label}<span class="visually-hidden">: {type.name}</span><span class="bk-arrow" aria-hidden="true">→</span>
47
+ </a>
48
+ </div>
49
+ </li>
50
+ ))}
51
+ </ul>
52
+ </Band>
53
+ )}
54
+
55
+ <style>
56
+ .bk-cards {
57
+ display: grid;
58
+ gap: clamp(1rem, 2vw, 1.5rem);
59
+ margin: 0;
60
+ padding: 0;
61
+ list-style: none;
62
+ }
63
+ :global(.lede) + .bk-cards {
64
+ margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
65
+ }
66
+ .bk-card {
67
+ display: flex;
68
+ flex-direction: column;
69
+ min-width: 0;
70
+ padding: clamp(1.25rem, 1rem + 0.8vw, 1.625rem);
71
+ border: 1px solid var(--line);
72
+ border-top: 0.25rem solid var(--accent);
73
+ border-radius: var(--radius-card);
74
+ background: var(--surface);
75
+ color: var(--ink);
76
+ }
77
+ .bk-card-body {
78
+ flex: 1 0 auto;
79
+ }
80
+ .bk-name {
81
+ margin: 0;
82
+ font-size: clamp(1.1875rem, 1.1rem + 0.3vw, 1.375rem);
83
+ }
84
+ .bk-description {
85
+ margin: 0.5rem 0 0;
86
+ color: var(--muted);
87
+ font-size: 0.9375rem;
88
+ line-height: 1.5;
89
+ }
90
+ .bk-meta {
91
+ margin: 0.875rem 0 0;
92
+ font-size: var(--text-sm);
93
+ font-weight: 700;
94
+ }
95
+ .bk-foot {
96
+ display: flex;
97
+ flex-wrap: wrap;
98
+ align-items: center;
99
+ justify-content: space-between;
100
+ gap: 0.75rem 1rem;
101
+ margin-top: 1.375rem;
102
+ }
103
+ .bk-price {
104
+ margin: 0;
105
+ font-family: var(--font-display);
106
+ font-size: 1.625rem;
107
+ font-weight: 800;
108
+ font-variant-numeric: lining-nums tabular-nums;
109
+ letter-spacing: -0.02em;
110
+ line-height: 1;
111
+ }
112
+ .bk-pick {
113
+ flex: 0 0 auto;
114
+ }
115
+ .bk-arrow {
116
+ margin-left: -0.125rem;
117
+ }
118
+ [data-count='1'] {
119
+ max-width: 26rem;
120
+ margin-inline: auto;
121
+ }
122
+ @media (min-width: 40rem) {
123
+ .bk-cards {
124
+ grid-template-columns: repeat(2, minmax(0, 1fr));
125
+ }
126
+ [data-count='1'] {
127
+ grid-template-columns: minmax(0, 1fr);
128
+ }
129
+ [data-count='2'] {
130
+ max-width: 48rem;
131
+ margin-inline: auto;
132
+ }
133
+ }
134
+ @media (min-width: 56rem) {
135
+ .bk-cards[data-count='3'] {
136
+ grid-template-columns: repeat(3, minmax(0, 1fr));
137
+ }
138
+ }
139
+ </style>
@@ -0,0 +1,144 @@
1
+ ---
2
+ // Booking, 'list' layout: the section head and the body, then a row per
3
+ // meeting type the organization's booking module offers, in its order, each
4
+ // on the band's surface: the type's name and its description at the left, its
5
+ // length and where it happens ("30 min · Video call") with its price under
6
+ // them ("$250", "Free"; nothing when the type names no price) in the middle,
7
+ // and the pick button ("Pick a time", the section's pick label) at the right,
8
+ // to the type's booking page in BackGold, where the time is picked and the
9
+ // booking made. The first row's button is solid and the rest are outlined, so
10
+ // the section has one dominant action. On a phone each row stacks: the words,
11
+ // the length, place and price, then the button full width.
12
+ //
13
+ // Nothing is drawn when the organization offers no meeting types, heading or
14
+ // not: the words would promise a booking that does not exist.
15
+ import type { ComponentProps } from 'astro/types'
16
+ import type Default from './index.astro'
17
+ import Band from '../Band.astro'
18
+ import SectionHead from '../SectionHead.astro'
19
+ import Prose from '../../Prose.astro'
20
+ import { meetingTypesOf } from './types'
21
+ import { text } from '../../../lib/format'
22
+
23
+ type Props = ComponentProps<typeof Default>
24
+
25
+ const { section } = Astro.props
26
+ const types = meetingTypesOf(section)
27
+ ---
28
+ {types.length > 0 && (
29
+ <Band section={section} class="booking booking-list">
30
+ <SectionHead kicker={text(section.copy.kicker)} heading={text(section.copy.heading)} more={[]} />
31
+ <Prose value={section.copy.body} class="lede" />
32
+ <ul class="bk-rows" role="list">
33
+ {types.map((type, i) => (
34
+ <li class="bk-row">
35
+ <div class="bk-row-words">
36
+ <h3 class="bk-row-name">{type.name}</h3>
37
+ {type.description && <p class="bk-row-description">{type.description}</p>}
38
+ </div>
39
+ {(type.meta || type.price) && (
40
+ <p class="bk-row-facts">
41
+ {type.meta && <span class="bk-row-meta">{type.meta}</span>}
42
+ {type.price && <span class="bk-row-price">{type.price}</span>}
43
+ </p>
44
+ )}
45
+ <p class="bk-row-action">
46
+ <a class:list={['button', i > 0 && 'button-quiet']} href={type.book.href} rel={type.book.rel}>
47
+ {type.book.label}<span class="visually-hidden">: {type.name}</span><span class="bk-arrow" aria-hidden="true">→</span>
48
+ </a>
49
+ </p>
50
+ </li>
51
+ ))}
52
+ </ul>
53
+ </Band>
54
+ )}
55
+
56
+ <style>
57
+ .bk-rows {
58
+ display: grid;
59
+ gap: 0.75rem;
60
+ margin: 0;
61
+ padding: 0;
62
+ list-style: none;
63
+ }
64
+ :global(.lede) + .bk-rows {
65
+ margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
66
+ }
67
+ /* A phone: the words, then the length, place and price, then the button across the bottom. */
68
+ .bk-row {
69
+ display: grid;
70
+ grid-template-columns: minmax(0, 1fr);
71
+ gap: 0.875rem;
72
+ align-items: center;
73
+ min-width: 0;
74
+ padding: 1.125rem 1.25rem;
75
+ border: 1px solid var(--line);
76
+ border-radius: var(--radius-card);
77
+ background: var(--surface);
78
+ color: var(--ink);
79
+ }
80
+ .bk-row-words {
81
+ min-width: 0;
82
+ }
83
+ .bk-row-name {
84
+ margin: 0;
85
+ font-size: var(--text-lg);
86
+ font-weight: 700;
87
+ line-height: 1.25;
88
+ letter-spacing: -0.01em;
89
+ }
90
+ .bk-row-description {
91
+ margin: 0.25rem 0 0;
92
+ color: var(--muted);
93
+ font-size: 0.9375rem;
94
+ line-height: 1.5;
95
+ }
96
+ .bk-row-facts {
97
+ display: flex;
98
+ margin: 0;
99
+ flex-wrap: wrap;
100
+ align-items: baseline;
101
+ gap: 0.25rem 0.875rem;
102
+ font-size: var(--text-sm);
103
+ }
104
+ .bk-row-meta {
105
+ font-weight: 700;
106
+ }
107
+ .bk-row-price {
108
+ font-family: var(--font-display);
109
+ font-size: 1.25rem;
110
+ font-weight: 800;
111
+ font-variant-numeric: lining-nums tabular-nums;
112
+ letter-spacing: -0.02em;
113
+ line-height: 1.1;
114
+ }
115
+ .bk-row-action {
116
+ margin: 0;
117
+ }
118
+ .bk-row-action .button {
119
+ width: 100%;
120
+ }
121
+ .bk-arrow {
122
+ margin-left: -0.125rem;
123
+ }
124
+ /* Wider: one line per type, the facts in a middle column, the button at the right. */
125
+ @media (min-width: 48rem) {
126
+ .bk-row {
127
+ grid-template-columns: minmax(0, 1fr) minmax(9rem, 13rem) auto;
128
+ gap: 0 1.5rem;
129
+ padding: 1.125rem 1.5rem;
130
+ }
131
+ .bk-row-facts {
132
+ grid-column: 2;
133
+ flex-direction: column;
134
+ align-items: flex-start;
135
+ }
136
+ .bk-row-action {
137
+ grid-column: 3;
138
+ }
139
+ .bk-row-action .button {
140
+ width: auto;
141
+ min-width: 9.5rem;
142
+ }
143
+ }
144
+ </style>
@@ -0,0 +1,60 @@
1
+ // A Booking section's rows as its layouts draw them. BackGold bakes the rows
2
+ // from the organization's booking module: one per active meeting type, in the
3
+ // order the operator's list of meeting types shows them, each with its public
4
+ // booking page (`url`), where the time is picked and the booking made. The
5
+ // section draws no calendar, no times and no form; every row's one action is a
6
+ // link to its booking page.
7
+ //
8
+ // A meeting type is worded the way the operator app words it: its length in
9
+ // minutes ("30 min") and where it happens ("Video call", "Phone call",
10
+ // "In person"; a custom place is "Details to follow", since the place's own
11
+ // words are not baked). Its price is a row's cents to the cent ("$250",
12
+ // "$19.50"), "Free" at 0, and nothing when the type names no price (null,
13
+ // every row today). A row with no name or no safe booking page is left out:
14
+ // a card that cannot be booked would promise a booking that does not exist.
15
+ // No rows draws nothing.
16
+
17
+ import type { Section } from '@backgold/content'
18
+ import { linkOf, rows, type Link } from '../../../lib/section'
19
+ import { formatCents, text } from '../../../lib/format'
20
+
21
+ /** Where a meeting happens, in the operator app's words (its `locationLabel`). */
22
+ const PLACES: Record<string, string> = {
23
+ video_link: 'Video call',
24
+ phone: 'Phone call',
25
+ in_person: 'In person',
26
+ custom: 'Details to follow',
27
+ }
28
+
29
+ export interface MeetingType {
30
+ name: string
31
+ description: string | null
32
+ /** "30 min · Video call": the length and the place, whichever the row has. */
33
+ meta: string | null
34
+ /** "$250", "$19.50", "Free", or null when the type names no price. */
35
+ price: string | null
36
+ /** The button to the type's booking page, worded by the section's pick label. */
37
+ book: Link
38
+ }
39
+
40
+ /** A price from cents through formatCents: whole dollars as "$250", anything else to the cent ("$19.50"); "Free" at 0. */
41
+ function priceOf(cents: unknown): string | null {
42
+ if (typeof cents !== 'number' || !Number.isInteger(cents) || cents < 0) return null
43
+ if (cents === 0) return 'Free'
44
+ const dollars = formatCents(cents - (cents % 100)) ?? ''
45
+ return cents % 100 === 0 ? dollars : `${dollars}.${String(cents % 100).padStart(2, '0')}`
46
+ }
47
+
48
+ /** The section's meeting types, in the rows' order; none when it has no bookable rows. */
49
+ export function meetingTypesOf(section: Section): MeetingType[] {
50
+ const label = text(section.copy.pickLabel)?.trim() ?? 'Pick a time'
51
+ return rows(section).flatMap((row): MeetingType[] => {
52
+ const name = text(row.name)?.trim()
53
+ const book = linkOf(label, row.url)
54
+ if (!name || !book) return []
55
+ const minutes = typeof row.duration_minutes === 'number' && Number.isInteger(row.duration_minutes) && row.duration_minutes > 0 ? row.duration_minutes : null
56
+ const place = PLACES[text(row.location_kind)?.trim() ?? ''] ?? null
57
+ const meta = [minutes !== null ? `${minutes} min` : null, place].filter((part): part is string => part !== null).join(' · ')
58
+ return [{ name, description: text(row.description)?.trim() ?? null, meta: meta || null, price: priceOf(row.price_cents), book }]
59
+ })
60
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ // Calendar · Agenda: the heading, then BackGold's calendar opening on its
3
+ // agenda.
4
+ import type { Section } from '@backgold/content'
5
+ import Headed from '../modules/Headed.astro'
6
+
7
+ interface Props {
8
+ section: Section
9
+ variant?: string
10
+ }
11
+
12
+ const { section } = Astro.props
13
+ ---
14
+ <Headed section={section} layout="agenda" height="46rem" />
@@ -0,0 +1,14 @@
1
+ ---
2
+ // Calendar · Month (board A12, the default): the heading, then BackGold's
3
+ // calendar opening on the month.
4
+ import type { Section } from '@backgold/content'
5
+ import Headed from '../modules/Headed.astro'
6
+
7
+ interface Props {
8
+ section: Section
9
+ variant?: string
10
+ }
11
+
12
+ const { section } = Astro.props
13
+ ---
14
+ <Headed section={section} layout="month" height="46rem" />