@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,126 @@
1
+ ---
2
+ // Progress, 'match' layout (board 09, B "Match deadline"): one raised card on
3
+ // the band's surface. At the left, the kicker as an accent chip (else, when
4
+ // the section sets a multiplier, "2× match"), the heading, the bar at the
5
+ // share of the goal raised and the figures under it, as BackGold last counted
6
+ // them when the page was published. At the right (under it, below 56rem), the
7
+ // time left until the match ends as four tiles, days, hours, minutes and
8
+ // seconds, and the one button, the section's donate link under its own label.
9
+ // Pages are cached until content changes, so the server writes the end of
10
+ // the match and a few lines of script count it down each second in the
11
+ // visitor's browser; once it has passed the tiles give way to "The match has
12
+ // ended" and the chip ("2× match active") goes. Without script the end reads plainly ("Ends Sunday, October 18,
13
+ // 2026 at 11:59 PM"). The clock (MatchClock.astro) is drawn only for an end
14
+ // that is a date.
15
+ // Nothing is drawn without a raised figure.
16
+ import type { ComponentProps } from 'astro/types'
17
+ import Band from '../Band.astro'
18
+ import type Default from './index.astro'
19
+ import { links, rows } from '../../../lib/section'
20
+ import { formatCents, formatWhen, text } from '../../../lib/format'
21
+ import MatchClock from './MatchClock.astro'
22
+
23
+ type Props = ComponentProps<typeof Default>
24
+
25
+ const { section } = Astro.props
26
+ const [row] = rows(section)
27
+ const raised = typeof row?.raised_cents === 'number' ? row.raised_cents : null
28
+ const goal = typeof row?.goal_cents === 'number' && row.goal_cents > 0 ? row.goal_cents : null
29
+ const percent = raised !== null && goal !== null ? Math.min(100, Math.round((raised / goal) * 100)) : null
30
+ const multiplier = section.options?.matchMultiplier
31
+ const times = typeof multiplier === 'number' && Number.isInteger(multiplier) && multiplier >= 2 && multiplier <= 10 ? multiplier : null
32
+ const chip = text(section.copy.kicker) ?? (times !== null ? `${times}× match` : null)
33
+ const heading = text(section.copy.heading)
34
+ const [give] = links(section)
35
+ const until = text(section.options?.matchUntil)?.trim() ?? null
36
+ const ends = until !== null && !Number.isNaN(Date.parse(until)) ? formatWhen(until) : null
37
+ ---
38
+ {raised !== null && (
39
+ <Band section={section} class="progress progress-match">
40
+ <div class:list={['match', (ends || give) && 'match-split']}>
41
+ <div class="match-main">
42
+ {chip && <p class="chip chip-accent match-chip" data-match-chip>{chip}</p>}
43
+ {heading && <h2 class="match-heading">{heading}</h2>}
44
+ {percent !== null && (
45
+ <div class="meter match-meter" role="img" aria-label={`${percent}% of the goal`}>
46
+ <span class="meter-fill" style={`width:${percent}%`}></span>
47
+ </div>
48
+ )}
49
+ <p class="match-figures">
50
+ <strong class="match-raised">{formatCents(raised)}</strong> raised
51
+ {goal !== null && <span> of a {formatCents(goal)} goal</span>}
52
+ </p>
53
+ </div>
54
+ {(ends || give) && (
55
+ <div class="match-side">
56
+ {ends && until && <MatchClock until={until} ends={ends} />}
57
+ {give && <a class="button match-give" href={give.href} rel={give.rel}>{give.label}</a>}
58
+ </div>
59
+ )}
60
+ </div>
61
+ </Band>
62
+ )}
63
+
64
+ <style>
65
+ .match {
66
+ display: grid;
67
+ gap: 1.75rem;
68
+ padding: clamp(1.375rem, 1rem + 1.5vw, 2.25rem);
69
+ border: 1px solid var(--line);
70
+ border-radius: var(--radius-card);
71
+ background: var(--surface);
72
+ box-shadow: var(--shadow);
73
+ }
74
+ .match-main {
75
+ min-width: 0;
76
+ }
77
+ .match-main > :last-child {
78
+ margin-bottom: 0;
79
+ }
80
+ .match-chip[hidden] {
81
+ display: none;
82
+ }
83
+ .match-chip {
84
+ margin: 0 0 0.875rem;
85
+ text-transform: uppercase;
86
+ }
87
+ .match-heading {
88
+ margin: 0;
89
+ font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
90
+ }
91
+ .match-meter {
92
+ height: 1.125rem;
93
+ margin: 1.25rem 0 0.875rem;
94
+ }
95
+ .match-figures {
96
+ margin: 0;
97
+ font-size: var(--text-lg);
98
+ }
99
+ .match-heading + .match-figures {
100
+ margin-top: 1rem;
101
+ }
102
+ .match-raised {
103
+ font-family: var(--font-display);
104
+ font-size: 1.25em;
105
+ font-weight: 800;
106
+ font-variant-numeric: lining-nums;
107
+ letter-spacing: -0.01em;
108
+ }
109
+ .match-side {
110
+ display: grid;
111
+ gap: 0.875rem;
112
+ min-width: 0;
113
+ }
114
+ .match-give {
115
+ display: flex;
116
+ width: 100%;
117
+ font-size: var(--text);
118
+ }
119
+ @media (min-width: 56rem) {
120
+ .match-split {
121
+ grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
122
+ gap: 2.5rem;
123
+ align-items: center;
124
+ }
125
+ }
126
+ </style>
@@ -0,0 +1,179 @@
1
+ ---
2
+ // Progress, 'ring' layout: one raised card on the band's surface. At the
3
+ // left, the share of the goal raised as a ring, a conic gradient in the
4
+ // button colour over the meter's track with the card's own ground as its
5
+ // hole, and the percent in the display face in the middle. Beside it (under
6
+ // it, below 40rem): the kicker as an accent chip (else, when the section sets
7
+ // a multiplier, "2× match"), the heading and the figures as BackGold last
8
+ // counted them when the page was published ("$18,400 raised of a $50,000
9
+ // goal"); then the time left until the match ends as match draws it
10
+ // (MatchClock.astro: four tiles counting down with script, "Ends …" without,
11
+ // "The match has ended" once it has passed, drawn only for an end that is a
12
+ // date) and the one button, the section's donate link under its own label,
13
+ // which from 56rem take a column of their own at the right, as in match.
14
+ // Without a goal there is no share to draw and no ring: the rest stands
15
+ // alone. Nothing is drawn without a raised figure.
16
+ import type { ComponentProps } from 'astro/types'
17
+ import Band from '../Band.astro'
18
+ import type Default from './index.astro'
19
+ import { links, rows } from '../../../lib/section'
20
+ import { formatCents, formatWhen, text } from '../../../lib/format'
21
+ import MatchClock from './MatchClock.astro'
22
+
23
+ type Props = ComponentProps<typeof Default>
24
+
25
+ const { section } = Astro.props
26
+ const [row] = rows(section)
27
+ const raised = typeof row?.raised_cents === 'number' ? row.raised_cents : null
28
+ const goal = typeof row?.goal_cents === 'number' && row.goal_cents > 0 ? row.goal_cents : null
29
+ const percent = raised !== null && goal !== null ? Math.min(100, Math.round((raised / goal) * 100)) : null
30
+ const multiplier = section.options?.matchMultiplier
31
+ const times = typeof multiplier === 'number' && Number.isInteger(multiplier) && multiplier >= 2 && multiplier <= 10 ? multiplier : null
32
+ const chip = text(section.copy.kicker) ?? (times !== null ? `${times}× match` : null)
33
+ const heading = text(section.copy.heading)
34
+ const [give] = links(section)
35
+ const until = text(section.options?.matchUntil)?.trim() ?? null
36
+ const ends = until !== null && !Number.isNaN(Date.parse(until)) ? formatWhen(until) : null
37
+ ---
38
+ {raised !== null && (
39
+ <Band section={section} class="progress progress-ring">
40
+ <div class:list={['ring-card', percent !== null && 'ring-card-drawn', (ends || give) && 'ring-card-side']}>
41
+ {percent !== null && (
42
+ <div class="ring" role="img" aria-label={`${percent}% of the goal`} style={`--ring-share: ${percent}%`}>
43
+ <span class="ring-percent" aria-hidden="true">{percent}%</span>
44
+ </div>
45
+ )}
46
+ <div class="ring-main">
47
+ {chip && <p class="chip chip-accent ring-chip" data-match-chip>{chip}</p>}
48
+ {heading && <h2 class="ring-heading">{heading}</h2>}
49
+ <p class="ring-figures">
50
+ <strong class="ring-raised">{formatCents(raised)}</strong> raised
51
+ {goal !== null && <span> of a {formatCents(goal)} goal</span>}
52
+ </p>
53
+ </div>
54
+ {(ends || give) && (
55
+ <div class="ring-side">
56
+ {ends && until && <MatchClock until={until} ends={ends} />}
57
+ {give && <a class="button ring-give" href={give.href} rel={give.rel}>{give.label}</a>}
58
+ </div>
59
+ )}
60
+ </div>
61
+ </Band>
62
+ )}
63
+
64
+ <style>
65
+ .ring-card {
66
+ display: grid;
67
+ gap: 1.5rem;
68
+ padding: clamp(1.375rem, 1rem + 1.5vw, 2.25rem);
69
+ border: 1px solid var(--line);
70
+ border-radius: var(--radius-card);
71
+ background: var(--surface);
72
+ box-shadow: var(--shadow);
73
+ }
74
+ .ring {
75
+ position: relative;
76
+ display: grid;
77
+ place-items: center;
78
+ width: 7rem;
79
+ aspect-ratio: 1;
80
+ border-radius: 50%;
81
+ background: conic-gradient(var(--button) 0 var(--ring-share), color-mix(in srgb, var(--ink) 15%, transparent) 0);
82
+ }
83
+ .ring::before {
84
+ content: '';
85
+ position: absolute;
86
+ inset: 0.875rem;
87
+ border-radius: 50%;
88
+ background: var(--surface);
89
+ }
90
+ .ring-percent {
91
+ position: relative;
92
+ font-family: var(--font-display);
93
+ font-size: 1.625rem;
94
+ font-weight: 800;
95
+ font-variant-numeric: lining-nums tabular-nums;
96
+ line-height: 1;
97
+ letter-spacing: -0.02em;
98
+ }
99
+ .ring-main {
100
+ min-width: 0;
101
+ }
102
+ .ring-chip[hidden] {
103
+ display: none;
104
+ }
105
+ .ring-chip {
106
+ margin: 0 0 0.875rem;
107
+ text-transform: uppercase;
108
+ }
109
+ .ring-heading {
110
+ margin: 0;
111
+ font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
112
+ }
113
+ .ring-figures {
114
+ margin: 0;
115
+ font-size: var(--text-lg);
116
+ }
117
+ .ring-heading + .ring-figures {
118
+ margin-top: 0.75rem;
119
+ }
120
+ .ring-raised {
121
+ font-family: var(--font-display);
122
+ font-size: 1.25em;
123
+ font-weight: 800;
124
+ font-variant-numeric: lining-nums;
125
+ letter-spacing: -0.01em;
126
+ }
127
+ /* With no chip or heading above them the figures are the card's headline. */
128
+ .ring-figures:first-child .ring-raised {
129
+ font-size: var(--h2);
130
+ letter-spacing: -0.02em;
131
+ }
132
+ .ring-side {
133
+ display: grid;
134
+ gap: 0.875rem;
135
+ min-width: 0;
136
+ }
137
+ .ring-give {
138
+ display: flex;
139
+ width: 100%;
140
+ font-size: var(--text);
141
+ }
142
+ /* Beside the ring from 40rem: the words, the clock and the button under them. */
143
+ @media (min-width: 40rem) {
144
+ .ring-card-drawn {
145
+ grid-template-columns: auto minmax(0, 1fr);
146
+ column-gap: clamp(1.75rem, 1rem + 2.5vw, 3rem);
147
+ align-items: center;
148
+ }
149
+ .ring-card-drawn.ring-card-side .ring {
150
+ grid-row: span 2;
151
+ }
152
+ .ring-card-drawn .ring-side {
153
+ max-width: 28rem;
154
+ }
155
+ .ring {
156
+ width: 9rem;
157
+ }
158
+ .ring-percent {
159
+ font-size: 2.125rem;
160
+ }
161
+ }
162
+ /* From 56rem the clock and the button take a third column, as match puts them. */
163
+ @media (min-width: 56rem) {
164
+ .ring-card-side {
165
+ grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
166
+ column-gap: 2.5rem;
167
+ align-items: center;
168
+ }
169
+ .ring-card-drawn.ring-card-side {
170
+ grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr);
171
+ }
172
+ .ring-card-drawn.ring-card-side .ring {
173
+ grid-row: auto;
174
+ }
175
+ .ring-card-drawn .ring-side {
176
+ max-width: none;
177
+ }
178
+ }
179
+ </style>
@@ -0,0 +1,149 @@
1
+ ---
2
+ // The donate card the grid and hero layouts place beside their words: a
3
+ // raised card on the band's surface holding the amounts three across (each in
4
+ // the display face, Other last), the monthly switch when the section offers
5
+ // it, the one button, and the note small under it. Picker.astro, right after
6
+ // it, makes the amounts a choice the button follows.
7
+ import Picker from './Picker.astro'
8
+ import { amountHref, dollars, giveLabel, type QuickDonate } from './donate'
9
+
10
+ interface Props {
11
+ qd: QuickDonate
12
+ }
13
+
14
+ const { qd } = Astro.props
15
+ ---
16
+ <div class="qd-card" data-quick-donate data-href={qd.donate.href} data-label={qd.donate.label}>
17
+ <ul class="qd-amounts" role="list" aria-label="Choose an amount">
18
+ {qd.amounts.map((amount) => (
19
+ <li>
20
+ <a class="qd-amount" href={amountHref(qd.donate.href, amount)} rel={qd.donate.rel} data-amount={amount} data-selected={amount === qd.selected ? '' : undefined}>
21
+ {dollars(amount)}
22
+ </a>
23
+ </li>
24
+ ))}
25
+ <li>
26
+ <a class="qd-amount qd-other" href={amountHref(qd.donate.href, null)} rel={qd.donate.rel} data-other>Other<span class="visually-hidden"> amount</span></a>
27
+ </li>
28
+ </ul>
29
+ {qd.monthly && (
30
+ <button type="button" class="qd-switch" role="switch" aria-checked="false" data-monthly hidden>
31
+ <span class="qd-switch-track" aria-hidden="true"><span class="qd-switch-thumb"></span></span>
32
+ <span>{qd.monthly}</span>
33
+ </button>
34
+ )}
35
+ <a class="button qd-give" href={amountHref(qd.donate.href, qd.selected)} rel={qd.donate.rel} data-give>{giveLabel(qd)}</a>
36
+ {qd.note && <p class="fine qd-note">{qd.note}</p>}
37
+ </div>
38
+ <Picker />
39
+
40
+ <style>
41
+ .qd-card {
42
+ padding: clamp(1.25rem, 0.9rem + 1.2vw, 1.75rem);
43
+ background: var(--surface);
44
+ border: 1px solid var(--line);
45
+ border-radius: var(--radius-card);
46
+ box-shadow: var(--shadow);
47
+ color: var(--ink);
48
+ }
49
+ .qd-amounts {
50
+ display: grid;
51
+ grid-template-columns: repeat(3, minmax(0, 1fr));
52
+ gap: 0.625rem;
53
+ margin: 0;
54
+ padding: 0;
55
+ list-style: none;
56
+ }
57
+ .qd-amount {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ min-height: 3.5rem;
62
+ padding: 0 0.5rem;
63
+ border: 2px solid var(--line-strong);
64
+ border-radius: var(--radius);
65
+ color: var(--ink);
66
+ font-family: var(--font-display);
67
+ font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
68
+ font-weight: 700;
69
+ font-variant-numeric: lining-nums tabular-nums;
70
+ letter-spacing: -0.01em;
71
+ text-decoration: none;
72
+ }
73
+ .qd-amount:hover {
74
+ border-color: var(--ink);
75
+ }
76
+ .qd-amount[data-selected] {
77
+ background: var(--button-2);
78
+ border-color: var(--button-2);
79
+ color: var(--button-2-ink);
80
+ }
81
+ .qd-other {
82
+ font-family: var(--font);
83
+ font-size: var(--text);
84
+ }
85
+ .qd-switch {
86
+ display: inline-flex;
87
+ align-items: center;
88
+ gap: 0.75rem;
89
+ min-height: 2.75rem;
90
+ margin: 0.875rem 0 0;
91
+ padding: 0 0.25rem 0 0;
92
+ border: 0;
93
+ background: none;
94
+ color: var(--ink);
95
+ font: inherit;
96
+ font-size: 0.9375rem;
97
+ font-weight: 600;
98
+ cursor: pointer;
99
+ }
100
+ .qd-switch[hidden] {
101
+ display: none;
102
+ }
103
+ .qd-switch-track {
104
+ position: relative;
105
+ flex: 0 0 auto;
106
+ width: 2.75rem;
107
+ height: 1.5rem;
108
+ border: 2px solid var(--line-strong);
109
+ border-radius: var(--pill);
110
+ }
111
+ .qd-switch-thumb {
112
+ position: absolute;
113
+ top: 0.1875rem;
114
+ left: 0.1875rem;
115
+ width: 0.875rem;
116
+ height: 0.875rem;
117
+ border-radius: 50%;
118
+ background: var(--muted);
119
+ }
120
+ .qd-switch[aria-checked='true'] .qd-switch-track {
121
+ background: var(--button-2);
122
+ border-color: var(--button-2);
123
+ }
124
+ .qd-switch[aria-checked='true'] .qd-switch-thumb {
125
+ background: var(--button-2-ink);
126
+ transform: translateX(1.25rem);
127
+ }
128
+ .qd-give {
129
+ display: flex;
130
+ width: 100%;
131
+ margin-top: 0.875rem;
132
+ font-size: var(--text);
133
+ }
134
+ .qd-note {
135
+ margin: 0.75rem 0 0;
136
+ text-align: center;
137
+ }
138
+ @media (prefers-reduced-motion: no-preference) {
139
+ .qd-amount,
140
+ .qd-switch-track,
141
+ .qd-switch-thumb {
142
+ transition:
143
+ background-color 0.15s ease,
144
+ border-color 0.15s ease,
145
+ color 0.15s ease,
146
+ transform 0.15s ease;
147
+ }
148
+ }
149
+ </style>
@@ -0,0 +1,95 @@
1
+ ---
2
+ // The island every QuickDonate layout places right after its picker (the
3
+ // element marked `data-quick-donate`). Without script each amount is a plain
4
+ // link to the donate page with its `?amount=`, Other links there with none,
5
+ // and the button carries the amount that starts selected. With script an
6
+ // amount is a toggle (`aria-pressed`) instead: picking one marks it, and the
7
+ // button's address and words ("Donate $50") follow it. The monthly switch
8
+ // and the bar's Dismiss are hidden until the script shows them: the switch
9
+ // sets `&frequency=monthly` on every address, and Dismiss hides the section
10
+ // and remembers that in `sessionStorage` for the rest of the visit.
11
+ ---
12
+ <script is:inline>
13
+ ;(function () {
14
+ var root = document.currentScript && document.currentScript.previousElementSibling
15
+ if (!root || !root.hasAttribute('data-quick-donate')) return
16
+ var base = root.getAttribute('data-href')
17
+ var label = root.getAttribute('data-label')
18
+ var amounts = Array.prototype.slice.call(root.querySelectorAll('[data-amount]'))
19
+ var other = root.querySelector('[data-other]')
20
+ var give = root.querySelector('[data-give]')
21
+ var monthly = root.querySelector('[data-monthly]')
22
+ var dismiss = root.querySelector('[data-dismiss]')
23
+ var selected = null
24
+ var recurring = false
25
+
26
+ if (dismiss) {
27
+ var band = root.closest('.bg-section') || root
28
+ var key = 'bg-quick-donate-dismissed:' + root.getAttribute('data-dismiss-key')
29
+ try {
30
+ if (sessionStorage.getItem(key)) {
31
+ band.hidden = true
32
+ return
33
+ }
34
+ } catch (e) {}
35
+ dismiss.hidden = false
36
+ dismiss.addEventListener('click', function () {
37
+ band.hidden = true
38
+ try {
39
+ sessionStorage.setItem(key, '1')
40
+ } catch (e) {}
41
+ })
42
+ }
43
+
44
+ function address(amount) {
45
+ var url = new URL(base, location.href)
46
+ url.searchParams.delete('amount')
47
+ url.searchParams.delete('frequency')
48
+ if (amount) url.searchParams.set('amount', amount)
49
+ if (recurring) url.searchParams.set('frequency', 'monthly')
50
+ return url.href
51
+ }
52
+
53
+ function paint() {
54
+ amounts.forEach(function (a) {
55
+ var value = a.getAttribute('data-amount')
56
+ var on = value === selected
57
+ a.setAttribute('aria-pressed', on ? 'true' : 'false')
58
+ if (on) a.setAttribute('data-selected', '')
59
+ else a.removeAttribute('data-selected')
60
+ a.href = address(value)
61
+ })
62
+ if (other) other.href = address(null)
63
+ if (give) {
64
+ give.href = address(selected)
65
+ give.textContent = selected ? label + ' $' + Number(selected).toLocaleString('en-US') : label
66
+ }
67
+ if (monthly) monthly.setAttribute('aria-checked', recurring ? 'true' : 'false')
68
+ }
69
+
70
+ function pick(a, e) {
71
+ e.preventDefault()
72
+ selected = a.getAttribute('data-amount')
73
+ paint()
74
+ }
75
+
76
+ amounts.forEach(function (a) {
77
+ if (a.hasAttribute('data-selected')) selected = a.getAttribute('data-amount')
78
+ a.setAttribute('role', 'button')
79
+ a.addEventListener('click', function (e) {
80
+ pick(a, e)
81
+ })
82
+ a.addEventListener('keydown', function (e) {
83
+ if (e.key === ' ') pick(a, e)
84
+ })
85
+ })
86
+ if (monthly) {
87
+ monthly.hidden = false
88
+ monthly.addEventListener('click', function () {
89
+ recurring = !recurring
90
+ paint()
91
+ })
92
+ }
93
+ paint()
94
+ })()
95
+ </script>