@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,231 @@
1
+ ---
2
+ // VoterTools, 'register' layout, the default (mock 02, A; the registration
3
+ // check is the official one the organization links to). Two cards side by
4
+ // side, stacked on a phone. The first asks: the kicker, the heading and the
5
+ // body, then BackGold's polling-place lookup when the section carries it
6
+ // (Lookup.astro), then the registration link as the main call and the
7
+ // polling-place link as an outline beside it (the polling link is the main
8
+ // call when there is no registration link). The second, raised on the band's card colour, is the
9
+ // visitor's plan: the election-day line in the display face, the early
10
+ // voting line under it, the ID note as a chip, then the key dates under
11
+ // `datesHeading`, each with its label, its day and its note; DaysLeft writes
12
+ // each date's state ("12 days left", "Today", "Closed") and lifts the
13
+ // nearest open one on a tint of the accent. Each card draws only what it has,
14
+ // and a card with nothing is left out. Nothing is drawn when the section
15
+ // has neither a heading, a link nor a date.
16
+ import type { Section } from '@backgold/content'
17
+ import Band from '../Band.astro'
18
+ import Prose from '../../Prose.astro'
19
+ import DaysLeft from './DaysLeft.astro'
20
+ import Lookup from './Lookup.astro'
21
+ import { voterTools } from './voter-tools'
22
+ import { prose } from '../../../lib/format'
23
+
24
+ interface Props {
25
+ section: Section
26
+ variant?: string
27
+ }
28
+
29
+ const { section } = Astro.props
30
+ const vt = voterTools(section)
31
+ const buttons = [vt.register, vt.polling].filter((link) => link !== null)
32
+ const lookup = !!section.embed
33
+ const asks = !!(vt.kicker || vt.heading || prose(section.copy.body) || buttons.length > 0 || lookup)
34
+ const plan = !!(vt.electionDay || vt.earlyVoting || vt.idNote || vt.dates.length > 0)
35
+ const shown = !!(vt.heading || buttons.length > 0 || vt.dates.length > 0 || lookup)
36
+ ---
37
+ {shown && (
38
+ <Band section={section} class="voter-tools vt-register">
39
+ <div class:list={['vt-cards', asks && plan && 'vt-cards-two']}>
40
+ {asks && (
41
+ <div class="vt-card vt-ask">
42
+ {vt.kicker && <p class="kicker">{vt.kicker}</p>}
43
+ {vt.heading && <h2>{vt.heading}</h2>}
44
+ <Prose value={section.copy.body} class="vt-body" />
45
+ {lookup && <Lookup section={section} />}
46
+ {buttons.length > 0 && (
47
+ <p class="actions vt-actions">
48
+ {buttons.map((link, i) => <a class:list={['button', i > 0 && 'button-quiet']} href={link.href} rel={link.rel}>{link.label}</a>)}
49
+ </p>
50
+ )}
51
+ </div>
52
+ )}
53
+ {plan && (
54
+ <div class="vt-card vt-plan">
55
+ {vt.electionDay && <p class="vt-lead">{vt.electionDay}</p>}
56
+ {vt.earlyVoting && <p class="vt-early">{vt.earlyVoting}</p>}
57
+ {vt.idNote && <p class="vt-id"><span class="chip">{vt.idNote}</span></p>}
58
+ {vt.dates.length > 0 && (
59
+ <div class="vt-deadlines">
60
+ {vt.datesHeading && <h3 class="vt-label">{vt.datesHeading}</h3>}
61
+ <ul class="vt-deadline-list" role="list">
62
+ {vt.dates.map((date) => (
63
+ <li class="vt-deadline" data-vt-date={date.day ?? undefined}>
64
+ <span class="vt-deadline-label">{date.label}</span>
65
+ {date.day && date.short && (
66
+ <time class="vt-deadline-day" datetime={date.day}>
67
+ <span aria-hidden="true">{date.short}</span>
68
+ <span class="visually-hidden">{date.full}</span>
69
+ </time>
70
+ )}
71
+ <span class="vt-deadline-meta">
72
+ {date.day && <span class="vt-state" data-vt-state></span>}
73
+ {date.note && <span class="vt-note">{date.note}</span>}
74
+ </span>
75
+ </li>
76
+ ))}
77
+ </ul>
78
+ </div>
79
+ )}
80
+ </div>
81
+ )}
82
+ </div>
83
+ {vt.dates.some((date) => date.day) && <DaysLeft />}
84
+ </Band>
85
+ )}
86
+
87
+ <style>
88
+ .vt-cards {
89
+ display: grid;
90
+ gap: clamp(1rem, 2vw, 1.5rem);
91
+ }
92
+ .vt-card {
93
+ min-width: 0;
94
+ padding: clamp(1.375rem, 1rem + 1.5vw, 2.25rem);
95
+ border: 1px solid var(--line);
96
+ border-radius: var(--radius-card);
97
+ }
98
+ .vt-card > :last-child {
99
+ margin-bottom: 0;
100
+ }
101
+ .vt-ask h2 {
102
+ max-width: 18ch;
103
+ }
104
+ .vt-ask :global(.vt-body) {
105
+ color: var(--muted);
106
+ font-size: var(--text-lg);
107
+ }
108
+ .vt-ask :global(.vt-body) > :last-child {
109
+ margin-bottom: 0;
110
+ }
111
+ .vt-actions {
112
+ margin-top: 1.75rem;
113
+ }
114
+ .vt-plan {
115
+ background: var(--surface);
116
+ box-shadow: var(--shadow);
117
+ }
118
+ .vt-lead {
119
+ margin: 0 0 0.625rem;
120
+ font-family: var(--font-display);
121
+ font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
122
+ font-weight: 700;
123
+ line-height: 1.15;
124
+ letter-spacing: -0.012em;
125
+ text-wrap: balance;
126
+ }
127
+ .vt-early {
128
+ margin: 0 0 1rem;
129
+ color: var(--muted);
130
+ }
131
+ .vt-id {
132
+ margin: 0 0 1.25rem;
133
+ }
134
+ .vt-deadlines {
135
+ margin-top: 1.5rem;
136
+ padding-top: 1.25rem;
137
+ border-top: 1px solid var(--line);
138
+ }
139
+ .vt-plan > .vt-deadlines:first-child {
140
+ margin-top: 0;
141
+ padding-top: 0;
142
+ border-top: 0;
143
+ }
144
+ .vt-label {
145
+ margin: 0 0 0.5rem;
146
+ color: var(--muted);
147
+ font-family: var(--font);
148
+ font-size: var(--text-xs);
149
+ font-weight: 700;
150
+ letter-spacing: 0.16em;
151
+ line-height: 1.4;
152
+ text-transform: uppercase;
153
+ }
154
+ .vt-deadline-list {
155
+ margin: 0;
156
+ padding: 0;
157
+ list-style: none;
158
+ }
159
+ /* A date's row: the label and its state over the note at the left, the day in the display face at the right. */
160
+ .vt-deadline {
161
+ display: grid;
162
+ grid-template-columns: minmax(0, 1fr) auto;
163
+ align-items: baseline;
164
+ gap: 0.125rem 1rem;
165
+ padding: 0.75rem 0;
166
+ border-top: 1px solid var(--line);
167
+ }
168
+ .vt-deadline:first-child {
169
+ border-top: 0;
170
+ }
171
+ .vt-deadline-label {
172
+ font-weight: 700;
173
+ }
174
+ .vt-deadline-day {
175
+ grid-row: 1 / span 2;
176
+ grid-column: 2;
177
+ align-self: center;
178
+ font-family: var(--font-display);
179
+ font-size: 1.375rem;
180
+ font-weight: 800;
181
+ letter-spacing: -0.01em;
182
+ line-height: 1;
183
+ white-space: nowrap;
184
+ }
185
+ .vt-deadline-meta {
186
+ display: flex;
187
+ flex-wrap: wrap;
188
+ gap: 0 0.75rem;
189
+ font-size: var(--text-sm);
190
+ }
191
+ .vt-deadline-meta:empty {
192
+ display: none;
193
+ }
194
+ .vt-state {
195
+ font-weight: 700;
196
+ }
197
+ .vt-state:empty {
198
+ display: none;
199
+ }
200
+ .vt-note {
201
+ color: var(--muted);
202
+ }
203
+ /* The nearest open date (DaysLeft): a tint of the accent behind it, its state and day in the accent. */
204
+ .vt-deadline.vt-next {
205
+ margin-inline: calc(-1 * clamp(1.375rem, 1rem + 1.5vw, 2.25rem));
206
+ padding-inline: clamp(1.375rem, 1rem + 1.5vw, 2.25rem);
207
+ background: color-mix(in srgb, var(--accent) 7%, transparent);
208
+ }
209
+ .vt-next .vt-state,
210
+ .vt-next .vt-deadline-day {
211
+ color: var(--accent);
212
+ }
213
+ .vt-next .vt-deadline-day {
214
+ font-size: 1.75rem;
215
+ }
216
+ .vt-closed .vt-deadline-label,
217
+ .vt-closed .vt-deadline-day,
218
+ .vt-closed .vt-state {
219
+ color: var(--muted);
220
+ }
221
+ .vt-closed .vt-deadline-day {
222
+ text-decoration: line-through;
223
+ text-decoration-thickness: 1px;
224
+ }
225
+ @media (min-width: 48rem) {
226
+ .vt-cards-two {
227
+ grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
228
+ align-items: start;
229
+ }
230
+ }
231
+ </style>
@@ -0,0 +1,144 @@
1
+ ---
2
+ // VoterTools, 'polling' layout (mock 02, B). The polling-place card leads,
3
+ // raised on the band's card colour: the kicker, the heading and the body,
4
+ // BackGold's polling-place lookup when the section carries it (Lookup.astro:
5
+ // the address search the mock drew, answered by BackGold), the official
6
+ // polling-place link as the main call, then under a rule the early
7
+ // voting line and the ID note as a chip. Beside it (under it on a phone) the
8
+ // election-day card: the election-day line large in the display face, with
9
+ // an accent rule over it, and the registration link as an outline (the main
10
+ // call when there is no polling link). The key dates belong to the 'dates'
11
+ // and 'register' layouts; this one leaves them out. Each card draws only
12
+ // what it has, and a card with nothing is left out. Nothing is drawn when
13
+ // the section has neither a heading, a link nor a date.
14
+ import type { ComponentProps } from 'astro/types'
15
+ import Band from '../Band.astro'
16
+ import Prose from '../../Prose.astro'
17
+ import type Default from './index.astro'
18
+ import Lookup from './Lookup.astro'
19
+ import { voterTools } from './voter-tools'
20
+ import { prose } from '../../../lib/format'
21
+
22
+ type Props = ComponentProps<typeof Default>
23
+
24
+ const { section } = Astro.props
25
+ const vt = voterTools(section)
26
+ const lookup = !!section.embed
27
+ const place = !!(vt.kicker || vt.heading || prose(section.copy.body) || vt.polling || vt.earlyVoting || vt.idNote || lookup)
28
+ const day = !!(vt.electionDay || vt.register)
29
+ const shown = !!(vt.heading || vt.register || vt.polling || vt.dates.length > 0 || lookup)
30
+ ---
31
+ {shown && (place || day) && (
32
+ <Band section={section} class="voter-tools vt-polling">
33
+ <div class:list={['vt-cards', place && day && 'vt-cards-two']}>
34
+ {place && (
35
+ <div class="vt-card vt-place">
36
+ {vt.kicker && <p class="kicker">{vt.kicker}</p>}
37
+ {vt.heading && <h2>{vt.heading}</h2>}
38
+ <Prose value={section.copy.body} class="vt-body" />
39
+ {lookup && <Lookup section={section} />}
40
+ {vt.polling && (
41
+ <p class="actions vt-actions">
42
+ <a class="button" href={vt.polling.href} rel={vt.polling.rel}>{vt.polling.label}</a>
43
+ </p>
44
+ )}
45
+ {(vt.earlyVoting || vt.idNote) && (
46
+ <div class="vt-details">
47
+ {vt.earlyVoting && <p class="vt-early">{vt.earlyVoting}</p>}
48
+ {vt.idNote && <p class="vt-id"><span class="chip">{vt.idNote}</span></p>}
49
+ </div>
50
+ )}
51
+ </div>
52
+ )}
53
+ {day && (
54
+ <div class="vt-card vt-day">
55
+ {vt.electionDay && <p class="vt-lead">{vt.electionDay}</p>}
56
+ {vt.register && (
57
+ <p class="vt-day-action">
58
+ <a class:list={['button', vt.polling && 'button-quiet']} href={vt.register.href} rel={vt.register.rel}>{vt.register.label}</a>
59
+ </p>
60
+ )}
61
+ </div>
62
+ )}
63
+ </div>
64
+ </Band>
65
+ )}
66
+
67
+ <style>
68
+ .vt-cards {
69
+ display: grid;
70
+ gap: clamp(1rem, 2vw, 1.5rem);
71
+ }
72
+ .vt-card {
73
+ min-width: 0;
74
+ padding: clamp(1.375rem, 1rem + 1.5vw, 2.25rem);
75
+ border: 1px solid var(--line);
76
+ border-radius: var(--radius-card);
77
+ }
78
+ .vt-card > :last-child {
79
+ margin-bottom: 0;
80
+ }
81
+ .vt-place {
82
+ background: var(--surface);
83
+ box-shadow: var(--shadow);
84
+ }
85
+ .vt-place h2 {
86
+ max-width: 18ch;
87
+ }
88
+ .vt-place :global(.vt-body) {
89
+ color: var(--muted);
90
+ font-size: var(--text-lg);
91
+ }
92
+ .vt-place :global(.vt-body) > :last-child {
93
+ margin-bottom: 0;
94
+ }
95
+ .vt-actions {
96
+ margin-top: 1.75rem;
97
+ }
98
+ .vt-details {
99
+ margin-top: 1.75rem;
100
+ padding-top: 1.25rem;
101
+ border-top: 1px solid var(--line);
102
+ }
103
+ .vt-place > .vt-details:first-child {
104
+ margin-top: 0;
105
+ padding-top: 0;
106
+ border-top: 0;
107
+ }
108
+ .vt-details > :last-child {
109
+ margin-bottom: 0;
110
+ }
111
+ .vt-early {
112
+ margin: 0 0 0.875rem;
113
+ font-weight: 600;
114
+ }
115
+ .vt-id {
116
+ margin: 0;
117
+ }
118
+ /* The election-day card: an accent rule, then the line large in the display face. */
119
+ .vt-day {
120
+ display: flex;
121
+ flex-direction: column;
122
+ gap: 1.5rem;
123
+ background: linear-gradient(var(--accent), var(--accent)) top / 100% 4px no-repeat;
124
+ }
125
+ .vt-day > * {
126
+ margin: 0;
127
+ }
128
+ .vt-lead {
129
+ font-family: var(--font-display);
130
+ font-size: clamp(1.75rem, 1.35rem + 1.4vw, 2.5rem);
131
+ font-weight: 800;
132
+ line-height: 1.08;
133
+ letter-spacing: -0.018em;
134
+ text-wrap: balance;
135
+ }
136
+ @media (min-width: 48rem) {
137
+ .vt-cards-two {
138
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
139
+ }
140
+ .vt-day {
141
+ justify-content: center;
142
+ }
143
+ }
144
+ </style>
@@ -0,0 +1,71 @@
1
+ // A VoterTools section as its layouts draw it: its words, its two links and
2
+ // its key dates. The links go to the official lookups the organization
3
+ // names (its state's registration check and polling-place finder). With the
4
+ // section's Polling place lookup on, the Content API also sends BackGold's
5
+ // own lookup as the section's embed, which each layout mounts (Lookup.astro)
6
+ // beside these. The Content API sends the links without their keys, so each
7
+ // is told apart by its label: the one labelled with `registerLabel` is the
8
+ // registration link, the one labelled with `pollingLabel` the polling link.
9
+ // A date row is drawn when it has a label; its `date` (YYYY-MM-DD, a
10
+ // calendar day) is kept only when it is one.
11
+
12
+ import type { Section } from '@backgold/content'
13
+ import { linkOf, rows, type Link } from '../../../lib/section'
14
+ import { formatDay, formatShortDay, text } from '../../../lib/format'
15
+
16
+ const CALENDAR_DAY = /^\d{4}-\d{2}-\d{2}$/
17
+
18
+ export interface KeyDate {
19
+ label: string
20
+ /** The row's YYYY-MM-DD, for `<time datetime>` and the island; null when the row has no usable date. */
21
+ day: string | null
22
+ /** "Oct 20" */
23
+ short: string | null
24
+ /** "October 20, 2026", for a screen reader. */
25
+ full: string | null
26
+ note: string | null
27
+ }
28
+
29
+ export interface VoterTools {
30
+ kicker: string | null
31
+ heading: string | null
32
+ register: Link | null
33
+ polling: Link | null
34
+ idNote: string | null
35
+ earlyVoting: string | null
36
+ electionDay: string | null
37
+ datesHeading: string | null
38
+ dates: KeyDate[]
39
+ }
40
+
41
+ export function voterTools(section: Section): VoterTools {
42
+ const copy = section.copy
43
+ const registerLabel = text(copy.registerLabel)
44
+ const pollingLabel = text(copy.pollingLabel)
45
+ let register: Link | null = null
46
+ let polling: Link | null = null
47
+ for (const raw of section.links ?? []) {
48
+ const link = linkOf(raw.label, raw.url)
49
+ if (!link) continue
50
+ if (!register && link.label === registerLabel) register = link
51
+ else if (!polling && link.label === pollingLabel) polling = link
52
+ }
53
+ const dates = rows(section).flatMap((row): KeyDate[] => {
54
+ const label = text(row.label)
55
+ if (!label) return []
56
+ const raw = text(row.date)?.trim() ?? null
57
+ const day = raw && CALENDAR_DAY.test(raw) && formatShortDay(raw) ? raw : null
58
+ return [{ label, day, short: formatShortDay(day), full: formatDay(day), note: text(row.note) }]
59
+ })
60
+ return {
61
+ kicker: text(copy.kicker),
62
+ heading: text(copy.heading),
63
+ register,
64
+ polling,
65
+ idNote: text(copy.idNote),
66
+ earlyVoting: text(copy.earlyVoting),
67
+ electionDay: text(copy.electionDay),
68
+ datesHeading: text(copy.datesHeading),
69
+ dates,
70
+ }
71
+ }