@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,172 @@
1
+ ---
2
+ // SampleBallot · Measures (mock 03, "Measures guide"): where the
3
+ // organization stands on each ballot measure. The kicker over the heading,
4
+ // the body, then a card per measure, two across (one on a phone): its title
5
+ // with the position at the right (YES in the band's accent, NO and No
6
+ // position as outlines, never a party's red or blue), the line on it, and
7
+ // "Read our analysis" when the row links to one. The races, when there are
8
+ // any, follow as a compact list, each office in small capitals over the
9
+ // name and party, with the endorsed chip on an endorsed race and the name
10
+ // linked to the candidate's page when the row has one; the measures then
11
+ // sit under `measuresHeading` so the two read apart. With no races, no
12
+ // measures and no heading it draws nothing.
13
+ import type { ComponentProps } from 'astro/types'
14
+ import type Default from './index.astro'
15
+ import Band from '../Band.astro'
16
+ import SectionHead from '../SectionHead.astro'
17
+ import Prose from '../../Prose.astro'
18
+ import Position from './Position.astro'
19
+ import { text } from '../../../lib/format'
20
+ import { ballotOf, nameWithParty } from './ballot'
21
+
22
+ type Props = ComponentProps<typeof Default>
23
+
24
+ const { section } = Astro.props
25
+ const kicker = text(section.copy.kicker)
26
+ const heading = text(section.copy.heading)
27
+ const endorsedLabel = text(section.copy.endorsedLabel) ?? 'Endorsed'
28
+ const measuresHeading = text(section.copy.measuresHeading) ?? 'Ballot measures'
29
+ const { races, measures } = ballotOf(section)
30
+ // Under `measuresHeading` (drawn when races follow) each title is a level lower.
31
+ const both = races.length > 0 && measures.length > 0
32
+ const Title = both ? 'h4' : 'h3'
33
+ ---
34
+ {(races.length > 0 || measures.length > 0 || heading) && (
35
+ <Band section={section} class="sample-ballot sample-ballot-measures">
36
+ <SectionHead kicker={kicker} heading={heading} more={[]} />
37
+ <Prose value={section.copy.body} class="lede" />
38
+ {both && <h3 class="measures-heading">{measuresHeading}</h3>}
39
+ {measures.length > 0 && (
40
+ <ul class="measure-cards" role="list">
41
+ {measures.map((measure) => (
42
+ <li class="measure-card">
43
+ <div class="measure-head">
44
+ <Title class="measure-title">{measure.title}</Title>
45
+ {measure.position && <Position position={measure.position} />}
46
+ </div>
47
+ {measure.summary && <p class="measure-summary">{measure.summary}</p>}
48
+ {measure.link && (
49
+ <p class="measure-more">
50
+ <a href={measure.link.href} rel={measure.link.rel}>
51
+ Read our analysis<span class="visually-hidden">: {measure.title}</span>
52
+ <span aria-hidden="true"> →</span>
53
+ </a>
54
+ </p>
55
+ )}
56
+ </li>
57
+ ))}
58
+ </ul>
59
+ )}
60
+ {races.length > 0 && (
61
+ <ul class="measure-races" role="list">
62
+ {races.map((race) => (
63
+ <li class="measure-race">
64
+ {race.office && <p class="measure-race-office">{race.office}</p>}
65
+ <p class="measure-race-name">
66
+ {race.link ? <a href={race.link.href} rel={race.link.rel}>{nameWithParty(race)}</a> : nameWithParty(race)}
67
+ </p>
68
+ {race.endorsed && <span class="chip chip-accent">{endorsedLabel}</span>}
69
+ </li>
70
+ ))}
71
+ </ul>
72
+ )}
73
+ </Band>
74
+ )}
75
+
76
+ <style>
77
+ .measures-heading {
78
+ margin: 0 0 1rem;
79
+ font-size: var(--h3);
80
+ }
81
+ .measure-cards {
82
+ display: grid;
83
+ grid-template-columns: minmax(0, 1fr);
84
+ gap: clamp(1rem, 2vw, 1.5rem);
85
+ margin: 0;
86
+ padding: 0;
87
+ list-style: none;
88
+ }
89
+ .measure-card {
90
+ display: flex;
91
+ flex-direction: column;
92
+ gap: 0.75rem;
93
+ padding: clamp(1.25rem, 1rem + 0.75vw, 1.625rem);
94
+ border: 1px solid var(--line);
95
+ border-radius: var(--radius);
96
+ background: var(--surface);
97
+ }
98
+ .measure-card > * {
99
+ margin: 0;
100
+ }
101
+ .measure-head {
102
+ display: flex;
103
+ align-items: flex-start;
104
+ justify-content: space-between;
105
+ gap: 1rem;
106
+ }
107
+ .measure-title {
108
+ min-width: 0;
109
+ margin: 0;
110
+ font-family: var(--font-display);
111
+ font-size: var(--text-lg);
112
+ font-weight: 700;
113
+ line-height: 1.25;
114
+ }
115
+ .measure-head :global(.position) {
116
+ flex: none;
117
+ margin-top: 0.125rem;
118
+ }
119
+ .measure-summary {
120
+ color: var(--muted);
121
+ }
122
+ .measure-more {
123
+ margin-top: auto;
124
+ padding-top: 0.25rem;
125
+ font-size: var(--text-sm);
126
+ font-weight: 700;
127
+ }
128
+ .measure-more a {
129
+ color: var(--link);
130
+ }
131
+ .measure-races {
132
+ display: grid;
133
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
134
+ gap: 0 clamp(1rem, 2vw, 1.75rem);
135
+ margin: clamp(2rem, 1.5rem + 1.5vw, 2.75rem) 0 0;
136
+ padding: 0;
137
+ list-style: none;
138
+ border-top: 2px solid var(--ink);
139
+ }
140
+ .measure-race {
141
+ display: flex;
142
+ flex-wrap: wrap;
143
+ align-items: center;
144
+ gap: 0.25rem 0.5rem;
145
+ padding: 0.875rem 0;
146
+ border-bottom: 1px solid var(--line);
147
+ }
148
+ .measure-race > p {
149
+ flex-basis: 100%;
150
+ margin: 0;
151
+ }
152
+ .measure-race-office {
153
+ color: var(--muted);
154
+ font-size: var(--text-xs);
155
+ font-weight: 700;
156
+ letter-spacing: 0.12em;
157
+ line-height: 1.4;
158
+ text-transform: uppercase;
159
+ }
160
+ .measure-race-name {
161
+ font-weight: 700;
162
+ line-height: 1.3;
163
+ }
164
+ .measure-race-name a {
165
+ color: var(--ink);
166
+ }
167
+ @media (min-width: 40rem) {
168
+ .measure-cards {
169
+ grid-template-columns: repeat(2, minmax(0, 1fr));
170
+ }
171
+ }
172
+ </style>
@@ -0,0 +1,141 @@
1
+ ---
2
+ // Scorecard, 'grades' layout (board 04, "Grade cards"): the section head and
3
+ // the body, then a card for each person the rows name: the photo (their
4
+ // initials when there is none) as the Team board draws it, the name in the
5
+ // display face, the office in the muted ink, the grade very large in the
6
+ // display face and the score under it ("94/100"). Every grade is drawn in the
7
+ // same ink whatever it is; the accent is only the rule along each card's
8
+ // top. Four cards across on a wide screen, two on a phone. Rows that name no
9
+ // one (the votes) are not drawn here. Nothing is drawn with neither a heading
10
+ // nor a person.
11
+ import type { ComponentProps } from 'astro/types'
12
+ import type Default from './index.astro'
13
+ import Band from '../Band.astro'
14
+ import SectionHead from '../SectionHead.astro'
15
+ import Prose from '../../Prose.astro'
16
+ import { text } from '../../../lib/format'
17
+ import { initials } from '../TeamGrid/people'
18
+ import { gradedOf } from './votes'
19
+
20
+ type Props = ComponentProps<typeof Default>
21
+
22
+ const { section } = Astro.props
23
+ const kicker = text(section.copy.kicker)
24
+ const heading = text(section.copy.heading)
25
+ const people = gradedOf(section)
26
+ ---
27
+ {(heading || people.length > 0) && (
28
+ <Band section={section} class="scorecard scorecard-grades">
29
+ <SectionHead kicker={kicker} heading={heading} more={[]} />
30
+ <Prose value={section.copy.body} class="lede" />
31
+ {people.length > 0 && (
32
+ <ul class="grades" role="list">
33
+ {people.map((p) => (
34
+ <li class="grade-card">
35
+ {p.photo ? (
36
+ <img class="grade-photo" src={p.photo} alt="" loading="lazy" decoding="async" />
37
+ ) : (
38
+ <span class="grade-photo grade-initials" aria-hidden="true">{initials(p.name)}</span>
39
+ )}
40
+ <h3 class="grade-name">{p.name}</h3>
41
+ {p.office && <p class="grade-office">{p.office}</p>}
42
+ {p.grade && (
43
+ <p class="grade-letter">
44
+ <span class="visually-hidden">Grade </span>{p.grade}
45
+ </p>
46
+ )}
47
+ {p.score !== null && (
48
+ <p class="grade-score">
49
+ <span class="visually-hidden">Score </span>{p.score}/100
50
+ </p>
51
+ )}
52
+ </li>
53
+ ))}
54
+ </ul>
55
+ )}
56
+ </Band>
57
+ )}
58
+
59
+ <style>
60
+ .grades {
61
+ display: grid;
62
+ grid-template-columns: repeat(2, minmax(0, 1fr));
63
+ gap: 0.75rem;
64
+ margin: 0;
65
+ padding: 0;
66
+ list-style: none;
67
+ }
68
+ .grade-card {
69
+ display: flex;
70
+ flex-direction: column;
71
+ align-items: center;
72
+ min-width: 0;
73
+ padding: 1.125rem 0.875rem 1rem;
74
+ border: 1px solid var(--line);
75
+ border-radius: calc(var(--radius) * 1.5);
76
+ background: var(--surface);
77
+ box-shadow: inset 0 3px 0 var(--accent);
78
+ text-align: center;
79
+ }
80
+ .grade-card > * {
81
+ margin: 0;
82
+ }
83
+ .grade-photo {
84
+ display: block;
85
+ width: 4.5rem;
86
+ aspect-ratio: 1;
87
+ object-fit: cover;
88
+ border-radius: var(--radius);
89
+ }
90
+ .grade-initials {
91
+ display: grid;
92
+ place-items: center;
93
+ background: color-mix(in srgb, var(--ink) 8%, transparent);
94
+ color: var(--muted);
95
+ font-family: var(--font-display);
96
+ font-size: 1.5rem;
97
+ font-weight: 700;
98
+ letter-spacing: 0.04em;
99
+ }
100
+ .grade-card .grade-name {
101
+ margin-top: 0.875rem;
102
+ font-size: var(--text-lg);
103
+ font-weight: 700;
104
+ line-height: 1.2;
105
+ }
106
+ .grade-card .grade-office {
107
+ margin-top: 0.25rem;
108
+ color: var(--muted);
109
+ font-size: var(--text-sm);
110
+ line-height: 1.35;
111
+ text-wrap: balance;
112
+ }
113
+ .grade-card .grade-letter {
114
+ margin-top: auto;
115
+ padding-top: 0.875rem;
116
+ font-family: var(--font-display);
117
+ font-size: clamp(3rem, 2.4rem + 2.4vw, 4.5rem);
118
+ font-weight: 800;
119
+ line-height: 1;
120
+ letter-spacing: -0.02em;
121
+ }
122
+ .grade-card .grade-score {
123
+ margin-top: 0.375rem;
124
+ color: var(--muted);
125
+ font-size: var(--text-sm);
126
+ font-weight: 600;
127
+ font-variant-numeric: tabular-nums;
128
+ }
129
+ @media (min-width: 48rem) {
130
+ .grades {
131
+ grid-template-columns: repeat(4, minmax(0, 1fr));
132
+ gap: 1.25rem;
133
+ }
134
+ .grade-card {
135
+ padding: 1.5rem 1.25rem 1.375rem;
136
+ }
137
+ .grade-photo {
138
+ width: 5.5rem;
139
+ }
140
+ }
141
+ </style>
@@ -0,0 +1,294 @@
1
+ ---
2
+ // Scorecard, 'table' layout, the default (board 04, "Vote tracker table"):
3
+ // the section head (the kicker and the heading), the body, then the votes as
4
+ // a table on the band's surface: the bill (linked to its roll call when the
5
+ // row has one), the issue, the vote as a chip (YEA, NAY, ABSENT), whether it
6
+ // agrees with the party's position (a check and "Agrees" in the accent, a
7
+ // cross and "Disagrees" in the muted ink; the word carries the meaning), and
8
+ // the day. A column no vote fills is left out. The source note sits small
9
+ // under the table.
10
+ //
11
+ // When the votes span more than one issue, a chip per issue ("All" first,
12
+ // then each issue in row order) narrows the table to that issue's votes. The
13
+ // chips are drawn hidden and shown by the section's script, so with scripts
14
+ // off every vote shows and nothing is offered that cannot work.
15
+ //
16
+ // On a phone each vote is a block of its own: the bill over its cells, each
17
+ // cell labelled with its column's header. Nothing is drawn with neither a
18
+ // heading nor a vote.
19
+ import type { Section } from '@backgold/content'
20
+ import Band from '../Band.astro'
21
+ import SectionHead from '../SectionHead.astro'
22
+ import Prose from '../../Prose.astro'
23
+ import { text } from '../../../lib/format'
24
+ import { votesOf } from './votes'
25
+
26
+ interface Props {
27
+ section: Section
28
+ variant?: string
29
+ }
30
+
31
+ const { section } = Astro.props
32
+ const kicker = text(section.copy.kicker)
33
+ const heading = text(section.copy.heading)
34
+ const sourceNote = text(section.copy.sourceNote)
35
+ const votes = votesOf(section)
36
+ const issues = [...new Set(votes.map((v) => v.issue).filter((issue): issue is string => issue !== null))]
37
+ const tableId = `${section.id}-votes`.replace(/[^A-Za-z0-9_-]/g, '-')
38
+ const columns = {
39
+ issue: votes.some((v) => v.issue),
40
+ vote: votes.some((v) => v.vote),
41
+ position: votes.some((v) => v.position),
42
+ date: votes.some((v) => v.day),
43
+ }
44
+ ---
45
+ {(heading || votes.length > 0) && (
46
+ <Band section={section} class="scorecard scorecard-table">
47
+ <SectionHead kicker={kicker} heading={heading} more={[]} />
48
+ <Prose value={section.copy.body} class="lede" />
49
+ {votes.length > 0 && (
50
+ <div class="score" data-scorecard>
51
+ {issues.length > 1 && (
52
+ <div class="score-issues" role="group" aria-label="Filter by issue" data-scorecard-issues hidden>
53
+ <button type="button" aria-pressed="true" aria-controls={tableId} data-scorecard-issue="">All</button>
54
+ {issues.map((issue) => (
55
+ <button type="button" aria-pressed="false" aria-controls={tableId} data-scorecard-issue={issue}>{issue}</button>
56
+ ))}
57
+ </div>
58
+ )}
59
+ <div class="score-frame">
60
+ <table class="score-table" id={tableId}>
61
+ {heading && <caption class="visually-hidden">{heading}</caption>}
62
+ <thead>
63
+ <tr>
64
+ <th scope="col">Bill</th>
65
+ {columns.issue && <th scope="col">Issue</th>}
66
+ {columns.vote && <th scope="col">Vote</th>}
67
+ {columns.position && <th scope="col">Position</th>}
68
+ {columns.date && <th scope="col">Date</th>}
69
+ </tr>
70
+ </thead>
71
+ <tbody>
72
+ {votes.map((v) => (
73
+ <tr class="score-row" data-issue={v.issue ?? ''}>
74
+ <td class="score-bill">{v.link ? <a href={v.link.href} rel={v.link.rel}>{v.bill}</a> : v.bill}</td>
75
+ {columns.issue && <td data-label="Issue">{v.issue}</td>}
76
+ {columns.vote && <td data-label="Vote">{v.vote && <span class:list={['chip', 'score-vote', v.vote === 'Absent' && 'score-vote-absent']}>{v.vote}</span>}</td>}
77
+ {columns.position && (
78
+ <td data-label="Position">
79
+ {v.position === 'agrees' && (
80
+ <span class="score-position score-agrees">
81
+ <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M3 8.5l3.2 3.2L13 4.8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /></svg>
82
+ Agrees
83
+ </span>
84
+ )}
85
+ {v.position === 'disagrees' && (
86
+ <span class="score-position score-disagrees">
87
+ <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M4.5 4.5l7 7M11.5 4.5l-7 7" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>
88
+ Disagrees
89
+ </span>
90
+ )}
91
+ </td>
92
+ )}
93
+ {columns.date && <td data-label="Date" class="score-date">{v.day && <time datetime={v.date}>{v.day}</time>}</td>}
94
+ </tr>
95
+ ))}
96
+ </tbody>
97
+ </table>
98
+ </div>
99
+ {issues.length > 1 && <p class="visually-hidden" role="status" data-scorecard-showing></p>}
100
+ {issues.length > 1 && (
101
+ <script is:inline>
102
+ (function (root) {
103
+ if (!root) return
104
+ var group = root.querySelector('[data-scorecard-issues]')
105
+ var chips = group.querySelectorAll('[data-scorecard-issue]')
106
+ var votes = root.querySelectorAll('tbody tr')
107
+ var showing = root.querySelector('[data-scorecard-showing]')
108
+ var choose = function (chip) {
109
+ var issue = chip.getAttribute('data-scorecard-issue')
110
+ var shown = 0
111
+ for (var c = 0; c < chips.length; c++) chips[c].setAttribute('aria-pressed', chips[c] === chip ? 'true' : 'false')
112
+ for (var v = 0; v < votes.length; v++) {
113
+ var match = !issue || votes[v].getAttribute('data-issue') === issue
114
+ votes[v].hidden = !match
115
+ if (match) shown++
116
+ }
117
+ showing.textContent = issue ? 'Showing ' + shown + ' of ' + votes.length + ' votes: ' + issue + '.' : 'Showing all ' + votes.length + ' votes.'
118
+ }
119
+ for (var c = 0; c < chips.length; c++) {
120
+ chips[c].addEventListener('click', function (event) {
121
+ choose(event.currentTarget)
122
+ })
123
+ }
124
+ group.hidden = false
125
+ })(document.currentScript.closest('[data-scorecard]'))
126
+ </script>
127
+ )}
128
+ </div>
129
+ )}
130
+ {votes.length > 0 && sourceNote && <p class="fine score-source">{sourceNote}</p>}
131
+ </Band>
132
+ )}
133
+
134
+ <style>
135
+ .score-issues {
136
+ display: flex;
137
+ flex-wrap: wrap;
138
+ gap: 0.5rem;
139
+ margin: 0 0 1rem;
140
+ }
141
+ .score-issues[hidden] {
142
+ display: none;
143
+ }
144
+ .score-issues button {
145
+ min-height: 2.75rem;
146
+ padding: 0.375rem 1rem;
147
+ border: 1.5px solid color-mix(in srgb, var(--ink) 25%, transparent);
148
+ border-radius: var(--pill);
149
+ background: transparent;
150
+ color: var(--ink);
151
+ font: inherit;
152
+ font-size: var(--text-sm);
153
+ font-weight: 600;
154
+ cursor: pointer;
155
+ }
156
+ .score-issues button:hover {
157
+ border-color: var(--ink);
158
+ }
159
+ .score-issues button[aria-pressed='true'] {
160
+ border-color: var(--button);
161
+ background: var(--button);
162
+ color: var(--button-ink);
163
+ }
164
+ .score-frame {
165
+ border: 1px solid var(--line);
166
+ border-radius: var(--radius-card);
167
+ background: var(--surface);
168
+ overflow: hidden;
169
+ }
170
+ .score-table {
171
+ width: 100%;
172
+ border-collapse: collapse;
173
+ font-size: 0.9375rem;
174
+ }
175
+ .score-table th {
176
+ padding: 0.875rem 1.125rem;
177
+ border-bottom: 1px solid var(--line-strong);
178
+ background: color-mix(in srgb, var(--ink) 5%, transparent);
179
+ color: var(--muted);
180
+ font-size: var(--text-xs);
181
+ font-weight: 700;
182
+ letter-spacing: 0.12em;
183
+ text-align: left;
184
+ text-transform: uppercase;
185
+ white-space: nowrap;
186
+ }
187
+ .score-table td {
188
+ padding: 0.9375rem 1.125rem;
189
+ border-bottom: 1px solid var(--line);
190
+ vertical-align: middle;
191
+ }
192
+ .score-row:last-child td {
193
+ border-bottom: 0;
194
+ }
195
+ .score-row[hidden] {
196
+ display: none;
197
+ }
198
+ .score-bill {
199
+ font-weight: 700;
200
+ }
201
+ .score-bill a {
202
+ color: var(--ink);
203
+ text-decoration: underline;
204
+ text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent);
205
+ }
206
+ .score-bill a:hover {
207
+ text-decoration-color: currentColor;
208
+ }
209
+ /* The vote is a fact, not a verdict: every vote wears the same neutral chip; an absence is drawn as a gap. */
210
+ .score-vote {
211
+ background: color-mix(in srgb, var(--ink) 9%, transparent);
212
+ color: var(--ink);
213
+ text-transform: uppercase;
214
+ }
215
+ .score-vote-absent {
216
+ background: transparent;
217
+ border: 1px dashed color-mix(in srgb, var(--ink) 35%, transparent);
218
+ color: var(--muted);
219
+ }
220
+ .score-position {
221
+ display: inline-flex;
222
+ align-items: center;
223
+ gap: 0.375rem;
224
+ font-weight: 600;
225
+ white-space: nowrap;
226
+ }
227
+ .score-position svg {
228
+ flex: 0 0 auto;
229
+ }
230
+ .score-agrees {
231
+ color: var(--accent);
232
+ }
233
+ .score-disagrees {
234
+ color: var(--muted);
235
+ }
236
+ .score-date {
237
+ color: var(--muted);
238
+ white-space: nowrap;
239
+ }
240
+ .score-source {
241
+ margin: 0.875rem 0 0;
242
+ }
243
+ /* A phone: each vote a block, the bill over its cells, each cell under its header's name. */
244
+ @media (max-width: 39.99rem) {
245
+ .score-table thead {
246
+ position: absolute;
247
+ width: 1px;
248
+ height: 1px;
249
+ overflow: hidden;
250
+ clip: rect(0 0 0 0);
251
+ white-space: nowrap;
252
+ }
253
+ .score-table,
254
+ .score-table tbody {
255
+ display: block;
256
+ }
257
+ .score-row {
258
+ display: grid;
259
+ grid-template-columns: repeat(2, minmax(0, 1fr));
260
+ gap: 0.75rem 1rem;
261
+ padding: 1rem 1.125rem;
262
+ border-bottom: 1px solid var(--line);
263
+ }
264
+ .score-row:last-child {
265
+ border-bottom: 0;
266
+ }
267
+ .score-table td {
268
+ display: grid;
269
+ align-content: start;
270
+ justify-items: start;
271
+ gap: 0.25rem;
272
+ padding: 0;
273
+ border: 0;
274
+ }
275
+ .score-table td::before {
276
+ content: attr(data-label);
277
+ color: var(--muted);
278
+ font-size: var(--text-xs);
279
+ font-weight: 700;
280
+ letter-spacing: 0.12em;
281
+ text-transform: uppercase;
282
+ }
283
+ .score-table .score-bill {
284
+ grid-column: 1 / -1;
285
+ font-size: var(--text);
286
+ }
287
+ .score-table .score-bill::before {
288
+ content: none;
289
+ }
290
+ .score-table td:empty {
291
+ display: none;
292
+ }
293
+ }
294
+ </style>