@backgold/template-kit 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/chunk-KOB36GSF.js +62 -0
- package/dist/constants-DvTNj4JI.d-Batjcj3Z.d.ts +38 -0
- package/dist/content-api-CYeY0vU8.d.ts +849 -0
- package/dist/contract/content-api-examples.d.ts +58 -0
- package/dist/contract/content-api-examples.js +783 -0
- package/dist/contract/content-api.d.ts +2 -0
- package/dist/contract/content-api.js +1 -0
- package/dist/contract/site-templates.d.ts +252 -0
- package/dist/contract/site-templates.js +185 -0
- package/package.json +70 -3
- package/src/components/EntryCard.astro +35 -0
- package/src/components/EventMap.astro +118 -0
- package/src/components/EventPage.astro +194 -0
- package/src/components/FieldValue.astro +41 -0
- package/src/components/LeadingHero.astro +21 -0
- package/src/components/NotFound.astro +20 -0
- package/src/components/PageSections.astro +47 -0
- package/src/components/Prose.astro +18 -0
- package/src/components/chrome/Brand.astro +54 -0
- package/src/components/chrome/ClosingCall.astro +94 -0
- package/src/components/chrome/DonateStrip.astro +61 -0
- package/src/components/chrome/FooterColumns.astro +32 -0
- package/src/components/chrome/FooterContact.astro +28 -0
- package/src/components/chrome/MenuList.astro +45 -0
- package/src/components/chrome/ModeToggle.astro +125 -0
- package/src/components/chrome/SignedInNotice.astro +53 -0
- package/src/components/chrome/SignupBand.astro +12 -0
- package/src/components/chrome/TakeoverBanner.astro +56 -0
- package/src/components/chrome/VisitorAccount.astro +82 -0
- package/src/components/entries/AuthorBox.astro +47 -0
- package/src/components/entries/EntryFields.astro +29 -0
- package/src/components/entries/EntryHeader.astro +77 -0
- package/src/components/entries/ListFrame.astro +126 -0
- package/src/components/entries/ListSearch.astro +24 -0
- package/src/components/entries/Share.astro +24 -0
- package/src/components/entries/course/classroom.astro +26 -0
- package/src/components/entries/course/lesson.astro +18 -0
- package/src/components/entries/course/section.ts +20 -0
- package/src/components/entries/course/syllabus.astro +15 -0
- package/src/components/entries/index.ts +77 -0
- package/src/components/entries/newsletter/issue.astro +41 -0
- package/src/components/entries/newsletter/list.astro +26 -0
- package/src/components/entries/podcast/episode.astro +42 -0
- package/src/components/entries/podcast/list.astro +36 -0
- package/src/components/entries/post/article.astro +31 -0
- package/src/components/entries/post/list.astro +85 -0
- package/src/components/entries/props.ts +61 -0
- package/src/components/entries/video/cards.astro +39 -0
- package/src/components/entries/video/grid.astro +15 -0
- package/src/components/entries/video/watch.astro +41 -0
- package/src/components/live/LivePage.astro +215 -0
- package/src/components/live/LocalTime.astro +29 -0
- package/src/components/sections/About/books.astro +188 -0
- package/src/components/sections/About/credentials.ts +90 -0
- package/src/components/sections/About/index.astro +57 -0
- package/src/components/sections/About/left.astro +54 -0
- package/src/components/sections/About/letter.astro +108 -0
- package/src/components/sections/About/portrait.astro +308 -0
- package/src/components/sections/Advocacy/compact.astro +14 -0
- package/src/components/sections/Advocacy/index.astro +14 -0
- package/src/components/sections/Band.astro +39 -0
- package/src/components/sections/Blog/feature.astro +176 -0
- package/src/components/sections/Blog/index.astro +37 -0
- package/src/components/sections/Blog/latest.ts +80 -0
- package/src/components/sections/Blog/list.astro +186 -0
- package/src/components/sections/Booking/index.astro +139 -0
- package/src/components/sections/Booking/list.astro +144 -0
- package/src/components/sections/Booking/types.ts +60 -0
- package/src/components/sections/Calendar/agenda.astro +14 -0
- package/src/components/sections/Calendar/index.astro +14 -0
- package/src/components/sections/CandidateRoster/ballot.astro +394 -0
- package/src/components/sections/CandidateRoster/candidates.ts +69 -0
- package/src/components/sections/CandidateRoster/compact.astro +115 -0
- package/src/components/sections/CandidateRoster/index.astro +57 -0
- package/src/components/sections/CaseStudies/beforeafter.astro +222 -0
- package/src/components/sections/CaseStudies/cases.ts +111 -0
- package/src/components/sections/CaseStudies/grid.astro +261 -0
- package/src/components/sections/CaseStudies/index.astro +333 -0
- package/src/components/sections/Classroom/CourseCard.astro +181 -0
- package/src/components/sections/Classroom/Courses.astro +88 -0
- package/src/components/sections/Classroom/classroom.ts +141 -0
- package/src/components/sections/Classroom/index.astro +20 -0
- package/src/components/sections/Classroom/list.astro +15 -0
- package/src/components/sections/Collection/compact.astro +7 -0
- package/src/components/sections/Collection/entries.ts +62 -0
- package/src/components/sections/Collection/feature.astro +180 -0
- package/src/components/sections/Collection/index.astro +46 -0
- package/src/components/sections/Collection/library.astro +271 -0
- package/src/components/sections/Collection/list.astro +7 -0
- package/src/components/sections/Collection/outline.astro +134 -0
- package/src/components/sections/Collection/shelves.astro +191 -0
- package/src/components/sections/Comparison/Unlisted.astro +6 -0
- package/src/components/sections/Comparison/cards.astro +171 -0
- package/src/components/sections/Comparison/index.astro +191 -0
- package/src/components/sections/Comparison/sides.ts +98 -0
- package/src/components/sections/Comparison/spectrum.astro +261 -0
- package/src/components/sections/ContentPost/banner.astro +152 -0
- package/src/components/sections/ContentPost/index.astro +35 -0
- package/src/components/sections/ContentPost/lesson.ts +119 -0
- package/src/components/sections/ContentPost/player.astro +254 -0
- package/src/components/sections/ContentPost/theater.astro +329 -0
- package/src/components/sections/Countdown/index.astro +53 -0
- package/src/components/sections/Course/Bar.astro +46 -0
- package/src/components/sections/Course/CourseHead.astro +123 -0
- package/src/components/sections/Course/Crumbs.astro +44 -0
- package/src/components/sections/Course/Icon.astro +29 -0
- package/src/components/sections/Course/Ring.astro +62 -0
- package/src/components/sections/Course/Syllabus.astro +146 -0
- package/src/components/sections/Course/course.ts +146 -0
- package/src/components/sections/Course/index.astro +143 -0
- package/src/components/sections/Course/outline.astro +39 -0
- package/src/components/sections/Cta/banner.astro +64 -0
- package/src/components/sections/Cta/card.astro +88 -0
- package/src/components/sections/Cta/index.astro +31 -0
- package/src/components/sections/Cta/photo.astro +114 -0
- package/src/components/sections/Cta/strip.astro +91 -0
- package/src/components/sections/Donate/index.astro +136 -0
- package/src/components/sections/Donate/story.astro +7 -0
- package/src/components/sections/Event/card.astro +14 -0
- package/src/components/sections/Event/index.astro +14 -0
- package/src/components/sections/EventsList/AgendaMonths.astro +105 -0
- package/src/components/sections/EventsList/CalendarLine.astro +23 -0
- package/src/components/sections/EventsList/EventRows.astro +196 -0
- package/src/components/sections/EventsList/LiveCounts.astro +75 -0
- package/src/components/sections/EventsList/TypeTabs.astro +53 -0
- package/src/components/sections/EventsList/agenda.astro +55 -0
- package/src/components/sections/EventsList/calendar.astro +392 -0
- package/src/components/sections/EventsList/cards.astro +186 -0
- package/src/components/sections/EventsList/cohorts.astro +205 -0
- package/src/components/sections/EventsList/compact.astro +163 -0
- package/src/components/sections/EventsList/events.ts +168 -0
- package/src/components/sections/EventsList/index.astro +46 -0
- package/src/components/sections/EventsList/map.astro +436 -0
- package/src/components/sections/EventsList/shifts.astro +355 -0
- package/src/components/sections/EventsList/week.astro +361 -0
- package/src/components/sections/Faq/Contact.astro +63 -0
- package/src/components/sections/Faq/Questions.astro +98 -0
- package/src/components/sections/Faq/cards.astro +74 -0
- package/src/components/sections/Faq/faq.ts +101 -0
- package/src/components/sections/Faq/index.astro +49 -0
- package/src/components/sections/Faq/topics.astro +178 -0
- package/src/components/sections/Financials/Foot.astro +38 -0
- package/src/components/sections/Financials/Head.astro +47 -0
- package/src/components/sections/Financials/donut.astro +197 -0
- package/src/components/sections/Financials/financials.ts +52 -0
- package/src/components/sections/Financials/index.astro +148 -0
- package/src/components/sections/Financials/table.astro +157 -0
- package/src/components/sections/FormBlock/index.astro +33 -0
- package/src/components/sections/FormBlock/wide.astro +7 -0
- package/src/components/sections/Hero/cover.astro +170 -0
- package/src/components/sections/Hero/donate.astro +209 -0
- package/src/components/sections/Hero/field.astro +390 -0
- package/src/components/sections/Hero/index.astro +52 -0
- package/src/components/sections/Hero/overlap.astro +151 -0
- package/src/components/sections/Hero/rotating.astro +30 -0
- package/src/components/sections/Hero/split.astro +96 -0
- package/src/components/sections/Hero/statement.astro +55 -0
- package/src/components/sections/Hero/video.astro +399 -0
- package/src/components/sections/Issues/checklist.astro +204 -0
- package/src/components/sections/Issues/drawer.astro +237 -0
- package/src/components/sections/Issues/index.astro +115 -0
- package/src/components/sections/Issues/issues.ts +37 -0
- package/src/components/sections/Issues/numbered.astro +79 -0
- package/src/components/sections/Issues/rows.astro +137 -0
- package/src/components/sections/Issues/steps.astro +81 -0
- package/src/components/sections/Issues/tabs.astro +322 -0
- package/src/components/sections/Leaderboard/index.astro +29 -0
- package/src/components/sections/Lesson/Door.astro +121 -0
- package/src/components/sections/Lesson/LessonBody.astro +416 -0
- package/src/components/sections/Lesson/Rail.astro +182 -0
- package/src/components/sections/Lesson/Tracker.astro +137 -0
- package/src/components/sections/Lesson/index.astro +27 -0
- package/src/components/sections/Lesson/lesson.ts +233 -0
- package/src/components/sections/Lesson/reading.astro +21 -0
- package/src/components/sections/Map/CoverageLine.astro +19 -0
- package/src/components/sections/Map/RegionMap.astro +109 -0
- package/src/components/sections/Map/bar.astro +160 -0
- package/src/components/sections/Map/index.astro +192 -0
- package/src/components/sections/Map/map.astro +275 -0
- package/src/components/sections/MediaKit/BioCard.astro +108 -0
- package/src/components/sections/MediaKit/Downloads.astro +88 -0
- package/src/components/sections/MediaKit/index.astro +183 -0
- package/src/components/sections/MediaKit/kit.ts +140 -0
- package/src/components/sections/MediaKit/press.astro +189 -0
- package/src/components/sections/MediaKit/speaker.astro +205 -0
- package/src/components/sections/Membership/Benefits.astro +42 -0
- package/src/components/sections/Membership/Check.astro +12 -0
- package/src/components/sections/Membership/Price.astro +61 -0
- package/src/components/sections/Membership/compare.astro +312 -0
- package/src/components/sections/Membership/index.astro +281 -0
- package/src/components/sections/Membership/offers.ts +169 -0
- package/src/components/sections/Membership/tiers.astro +217 -0
- package/src/components/sections/MovementMap/index.astro +50 -0
- package/src/components/sections/MovementTicker/index.astro +43 -0
- package/src/components/sections/Pathways/Doors.astro +147 -0
- package/src/components/sections/Pathways/Head.astro +37 -0
- package/src/components/sections/Pathways/index.astro +27 -0
- package/src/components/sections/Pathways/pathways.ts +100 -0
- package/src/components/sections/Pathways/quiz.astro +286 -0
- package/src/components/sections/Pathways/tabs.astro +271 -0
- package/src/components/sections/PdfEmbed/card.astro +99 -0
- package/src/components/sections/PdfEmbed/index.astro +26 -0
- package/src/components/sections/PdfEmbed/medium.astro +7 -0
- package/src/components/sections/PdfEmbed/tall.astro +7 -0
- package/src/components/sections/Petition/coverage.astro +14 -0
- package/src/components/sections/Petition/image.astro +14 -0
- package/src/components/sections/Petition/index.astro +14 -0
- package/src/components/sections/Petition/map.astro +14 -0
- package/src/components/sections/PlatformPlanks/anchors.ts +66 -0
- package/src/components/sections/PlatformPlanks/columns.astro +171 -0
- package/src/components/sections/PlatformPlanks/index.astro +56 -0
- package/src/components/sections/PlatformPlanks/longread.astro +250 -0
- package/src/components/sections/PollBlock/index.astro +30 -0
- package/src/components/sections/Portfolio/featured.astro +343 -0
- package/src/components/sections/Portfolio/index.astro +571 -0
- package/src/components/sections/Portfolio/strip.astro +173 -0
- package/src/components/sections/Portfolio/work.ts +100 -0
- package/src/components/sections/Progress/MatchClock.astro +166 -0
- package/src/components/sections/Progress/compact.astro +150 -0
- package/src/components/sections/Progress/index.astro +32 -0
- package/src/components/sections/Progress/match.astro +126 -0
- package/src/components/sections/Progress/ring.astro +179 -0
- package/src/components/sections/QuickDonate/DonateCard.astro +149 -0
- package/src/components/sections/QuickDonate/Picker.astro +95 -0
- package/src/components/sections/QuickDonate/band.astro +164 -0
- package/src/components/sections/QuickDonate/bar.astro +208 -0
- package/src/components/sections/QuickDonate/donate.ts +126 -0
- package/src/components/sections/QuickDonate/hero.astro +143 -0
- package/src/components/sections/QuickDonate/index.astro +73 -0
- package/src/components/sections/QuickDonate/jar.astro +225 -0
- package/src/components/sections/QuickDonate/ladder.astro +248 -0
- package/src/components/sections/QuoteStrip/carousel.astro +340 -0
- package/src/components/sections/QuoteStrip/index.astro +58 -0
- package/src/components/sections/QuoteStrip/logos.astro +226 -0
- package/src/components/sections/QuoteStrip/quotes.ts +61 -0
- package/src/components/sections/QuoteStrip/single.astro +92 -0
- package/src/components/sections/QuoteStrip/ticker.astro +319 -0
- package/src/components/sections/QuoteStrip/wall.astro +113 -0
- package/src/components/sections/Resources/band.astro +93 -0
- package/src/components/sections/Resources/featured.astro +239 -0
- package/src/components/sections/Resources/index.astro +225 -0
- package/src/components/sections/Resources/resources.ts +92 -0
- package/src/components/sections/SampleBallot/Position.astro +39 -0
- package/src/components/sections/SampleBallot/ballot.ts +92 -0
- package/src/components/sections/SampleBallot/cards.astro +299 -0
- package/src/components/sections/SampleBallot/index.astro +326 -0
- package/src/components/sections/SampleBallot/measures.astro +172 -0
- package/src/components/sections/Scorecard/grades.astro +141 -0
- package/src/components/sections/Scorecard/index.astro +294 -0
- package/src/components/sections/Scorecard/promise.astro +167 -0
- package/src/components/sections/Scorecard/votes.ts +83 -0
- package/src/components/sections/SectionHead.astro +31 -0
- package/src/components/sections/Services/Button.astro +24 -0
- package/src/components/sections/Services/Check.astro +12 -0
- package/src/components/sections/Services/Includes.astro +42 -0
- package/src/components/sections/Services/compare.astro +328 -0
- package/src/components/sections/Services/index.astro +187 -0
- package/src/components/sections/Services/list.astro +181 -0
- package/src/components/sections/Services/services.ts +80 -0
- package/src/components/sections/ShareKit/Actions.astro +71 -0
- package/src/components/sections/ShareKit/Buttons.astro +62 -0
- package/src/components/sections/ShareKit/compact.astro +123 -0
- package/src/components/sections/ShareKit/index.astro +160 -0
- package/src/components/sections/ShareKit/share.ts +60 -0
- package/src/components/sections/ShareKit/strip.astro +173 -0
- package/src/components/sections/SignupCapture/band.astro +7 -0
- package/src/components/sections/SignupCapture/index.astro +103 -0
- package/src/components/sections/SignupCapture/inline.astro +7 -0
- package/src/components/sections/SocialFeed/index.astro +34 -0
- package/src/components/sections/StatCards/feature.astro +143 -0
- package/src/components/sections/StatCards/index.astro +51 -0
- package/src/components/sections/StatCards/ribbon.astro +113 -0
- package/src/components/sections/StatCards/wall.astro +177 -0
- package/src/components/sections/Store/featured.astro +14 -0
- package/src/components/sections/Store/index.astro +14 -0
- package/src/components/sections/Stories/Status.astro +42 -0
- package/src/components/sections/Stories/StoryCards.astro +171 -0
- package/src/components/sections/Stories/cards.astro +42 -0
- package/src/components/sections/Stories/index.astro +238 -0
- package/src/components/sections/Stories/stories.ts +97 -0
- package/src/components/sections/Stories/timeline.astro +135 -0
- package/src/components/sections/TeamGrid/board.astro +280 -0
- package/src/components/sections/TeamGrid/index.astro +71 -0
- package/src/components/sections/TeamGrid/list.astro +306 -0
- package/src/components/sections/TeamGrid/people.ts +178 -0
- package/src/components/sections/VideoEmbed/index.astro +52 -0
- package/src/components/sections/VideoEmbed/landscape.astro +7 -0
- package/src/components/sections/VideoEmbed/portrait.astro +7 -0
- package/src/components/sections/VideoEmbed/square.astro +7 -0
- package/src/components/sections/VoterTools/DaysLeft.astro +33 -0
- package/src/components/sections/VoterTools/dates.astro +149 -0
- package/src/components/sections/VoterTools/index.astro +228 -0
- package/src/components/sections/VoterTools/polling.astro +141 -0
- package/src/components/sections/VoterTools/voter-tools.ts +70 -0
- package/src/components/sections/index.ts +370 -0
- package/src/components/sections/modules/Headed.astro +39 -0
- package/src/components/sections/modules/ModuleFrame.astro +179 -0
- package/src/components/volunteer/ShiftLive.astro +90 -0
- package/src/components/volunteer/detail.astro +247 -0
- package/src/components/volunteer/list.astro +298 -0
- package/src/components/volunteer/props.ts +21 -0
- package/src/env.d.ts +22 -0
- package/src/index.d.ts +10 -0
- package/src/index.js +64 -0
- package/src/layouts/Site.astro +371 -0
- package/src/lib/academy.ts +146 -0
- package/src/lib/brand.ts +534 -0
- package/src/lib/chrome.ts +119 -0
- package/src/lib/donate-frame.ts +64 -0
- package/src/lib/entries.ts +190 -0
- package/src/lib/env.ts +34 -0
- package/src/lib/event-map-draw.ts +91 -0
- package/src/lib/events.ts +476 -0
- package/src/lib/fonts.ts +116 -0
- package/src/lib/footer.ts +24 -0
- package/src/lib/format.ts +160 -0
- package/src/lib/geo.ts +131 -0
- package/src/lib/live.ts +54 -0
- package/src/lib/menu.ts +48 -0
- package/src/lib/petition-text.ts +29 -0
- package/src/lib/reading.ts +17 -0
- package/src/lib/regions.ts +215 -0
- package/src/lib/section.ts +94 -0
- package/src/lib/shifts.ts +186 -0
- package/src/lib/stream-time.ts +20 -0
- package/src/lib/stream.ts +141 -0
- package/src/lib/visitor.ts +54 -0
- package/src/routes/catch-all.astro +286 -0
- package/src/routes/form.astro +30 -0
- package/src/routes/live.astro +49 -0
- package/src/routes/not-found.astro +18 -0
- package/src/routes/preview.astro +60 -0
- package/src/routes/setup.astro +62 -0
- package/src/routes/volunteer-shift.astro +61 -0
- package/src/routes/volunteer.astro +37 -0
- package/src/styles/entries.css +784 -0
- package/src/styles/site.css +1839 -0
- package/src/template.ts +182 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
// ContentPost · Player (board 02, A, "Player + outline sidebar"): the piece's
|
|
3
|
+
// media large at the left, as its entry page plays it (lesson.ts): a video
|
|
4
|
+
// in its player at 16:9, a podcast's audio in the browser's controls beside
|
|
5
|
+
// its cover, the hero alone when the piece has no media. Under it the
|
|
6
|
+
// section's heading as a kicker, the title (linking to the piece's page on
|
|
7
|
+
// this site) and its date, then `notesLabel` ("Notes") as a small heading
|
|
8
|
+
// over the notes, the piece's body. At the right a panel headed by
|
|
9
|
+
// `linksHeading` ("In this lesson") numbers the section's links: the
|
|
10
|
+
// operator's syllabus, worksheets and further reading. Without links the
|
|
11
|
+
// panel is left out and the media and notes take the reading column.
|
|
12
|
+
// Nothing here knows who is watching: no progress, no "mark complete", no
|
|
13
|
+
// quiz.
|
|
14
|
+
//
|
|
15
|
+
// On a phone (and up to 56rem) the panel follows the notes. With no piece
|
|
16
|
+
// baked the section draws nothing, as the Card layout does.
|
|
17
|
+
import type { ComponentProps } from 'astro/types'
|
|
18
|
+
import type Default from './index.astro'
|
|
19
|
+
import Band from '../Band.astro'
|
|
20
|
+
import { lessonOf } from './lesson'
|
|
21
|
+
import { idFor } from '../SampleBallot/ballot'
|
|
22
|
+
|
|
23
|
+
type Props = ComponentProps<typeof Default>
|
|
24
|
+
|
|
25
|
+
const { section } = Astro.props
|
|
26
|
+
const lesson = await lessonOf(section, Astro.locals.backgold)
|
|
27
|
+
const linksId = idFor(section, 'player-links')
|
|
28
|
+
---
|
|
29
|
+
{lesson && (
|
|
30
|
+
<Band section={section} class="featured lesson-player">
|
|
31
|
+
<div class:list={['lp', lesson.links.length > 0 && 'lp-with-links']}>
|
|
32
|
+
<div class="lp-main">
|
|
33
|
+
{lesson.media?.kind === 'embed' && (
|
|
34
|
+
<div class="lp-frame">
|
|
35
|
+
<iframe src={lesson.media.src} title={lesson.title} allow="encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe>
|
|
36
|
+
</div>
|
|
37
|
+
)}
|
|
38
|
+
{lesson.media?.kind === 'video' && (
|
|
39
|
+
<div class="lp-frame">
|
|
40
|
+
<video src={lesson.media.src} poster={lesson.media.poster ?? undefined} controls preload="none" playsinline>
|
|
41
|
+
<a href={lesson.media.src}>Watch the video</a>
|
|
42
|
+
</video>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
{lesson.media?.kind === 'audio' && (
|
|
46
|
+
<div class="lp-audio">
|
|
47
|
+
{lesson.media.cover && <img class="lp-cover" src={lesson.media.cover} alt="" width="160" height="160" decoding="async" />}
|
|
48
|
+
<audio src={lesson.media.src} controls preload="none">
|
|
49
|
+
<a href={lesson.media.src}>Download the audio</a>
|
|
50
|
+
</audio>
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
{lesson.media?.kind === 'image' && <img class="lp-image" src={lesson.media.src} alt="" decoding="async" />}
|
|
54
|
+
<div class="lp-head">
|
|
55
|
+
{lesson.kicker && <p class="kicker">{lesson.kicker}</p>}
|
|
56
|
+
<h2 class="lp-title featured-title">{lesson.href ? <a href={lesson.href}>{lesson.title}</a> : lesson.title}</h2>
|
|
57
|
+
{lesson.day && lesson.date && <p class="fine"><time datetime={lesson.date}>{lesson.day}</time></p>}
|
|
58
|
+
</div>
|
|
59
|
+
{lesson.notes && (
|
|
60
|
+
<div class="lp-notes">
|
|
61
|
+
<h3 class="lp-label">{lesson.notesLabel}</h3>
|
|
62
|
+
<div class="prose" set:html={lesson.notes} />
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
</div>
|
|
66
|
+
{lesson.links.length > 0 && (
|
|
67
|
+
<aside class="lp-side" aria-labelledby={linksId}>
|
|
68
|
+
<h3 class="lp-side-title" id={linksId}>{lesson.linksHeading ?? 'In this lesson'}</h3>
|
|
69
|
+
<ol class="lp-links" role="list">
|
|
70
|
+
{lesson.links.map((link, i) => (
|
|
71
|
+
<li>
|
|
72
|
+
<a href={link.href} rel={link.rel}>
|
|
73
|
+
<span class="lp-num" aria-hidden="true">{i + 1}</span>
|
|
74
|
+
<span class="lp-link-label">{link.label}</span>
|
|
75
|
+
</a>
|
|
76
|
+
</li>
|
|
77
|
+
))}
|
|
78
|
+
</ol>
|
|
79
|
+
</aside>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
</Band>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.lp {
|
|
87
|
+
display: grid;
|
|
88
|
+
gap: 1.75rem;
|
|
89
|
+
}
|
|
90
|
+
.lp:not(.lp-with-links) {
|
|
91
|
+
max-width: calc(var(--measure) + 8rem);
|
|
92
|
+
}
|
|
93
|
+
.lp-main {
|
|
94
|
+
display: grid;
|
|
95
|
+
gap: 1.25rem;
|
|
96
|
+
min-width: 0;
|
|
97
|
+
}
|
|
98
|
+
.lp-main > * {
|
|
99
|
+
margin: 0;
|
|
100
|
+
}
|
|
101
|
+
.lp-frame {
|
|
102
|
+
position: relative;
|
|
103
|
+
aspect-ratio: 16 / 9;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
border-radius: var(--radius);
|
|
106
|
+
background: color-mix(in srgb, var(--ink) 12%, transparent);
|
|
107
|
+
}
|
|
108
|
+
.lp-frame iframe,
|
|
109
|
+
.lp-frame video {
|
|
110
|
+
display: block;
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
border: 0;
|
|
114
|
+
}
|
|
115
|
+
.lp-audio {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-wrap: wrap;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: 1rem 1.5rem;
|
|
120
|
+
padding: 1.25rem;
|
|
121
|
+
border: 1px solid var(--line);
|
|
122
|
+
border-radius: var(--radius);
|
|
123
|
+
background: var(--surface);
|
|
124
|
+
}
|
|
125
|
+
.lp-cover {
|
|
126
|
+
width: 7.5rem;
|
|
127
|
+
height: 7.5rem;
|
|
128
|
+
border-radius: calc(var(--radius) / 1.5);
|
|
129
|
+
object-fit: cover;
|
|
130
|
+
}
|
|
131
|
+
.lp-audio audio {
|
|
132
|
+
flex: 1 1 16rem;
|
|
133
|
+
min-width: 0;
|
|
134
|
+
width: 100%;
|
|
135
|
+
}
|
|
136
|
+
.lp-image {
|
|
137
|
+
display: block;
|
|
138
|
+
width: 100%;
|
|
139
|
+
aspect-ratio: 16 / 9;
|
|
140
|
+
border-radius: var(--radius);
|
|
141
|
+
object-fit: cover;
|
|
142
|
+
}
|
|
143
|
+
.lp-head > * {
|
|
144
|
+
margin: 0;
|
|
145
|
+
}
|
|
146
|
+
.lp-head .kicker {
|
|
147
|
+
margin-bottom: 0.5rem;
|
|
148
|
+
}
|
|
149
|
+
.lp-head .lp-title {
|
|
150
|
+
font-size: calc(var(--h2) * 0.75);
|
|
151
|
+
line-height: 1.12;
|
|
152
|
+
}
|
|
153
|
+
.lp-head .fine {
|
|
154
|
+
margin-top: 0.375rem;
|
|
155
|
+
}
|
|
156
|
+
.lp-notes {
|
|
157
|
+
min-width: 0;
|
|
158
|
+
}
|
|
159
|
+
.lp-label {
|
|
160
|
+
margin: 0 0 0.625rem;
|
|
161
|
+
color: var(--muted);
|
|
162
|
+
font-family: var(--font);
|
|
163
|
+
font-size: var(--text-xs);
|
|
164
|
+
font-weight: 700;
|
|
165
|
+
letter-spacing: 0.14em;
|
|
166
|
+
line-height: 1.4;
|
|
167
|
+
text-transform: uppercase;
|
|
168
|
+
}
|
|
169
|
+
.lp-notes .prose > :global(:first-child) {
|
|
170
|
+
margin-top: 0;
|
|
171
|
+
}
|
|
172
|
+
.lp-notes .prose > :global(:last-child) {
|
|
173
|
+
margin-bottom: 0;
|
|
174
|
+
}
|
|
175
|
+
/* The body's headings, moved under the notes' own (lesson.ts). */
|
|
176
|
+
.lp-notes .prose :global(h4),
|
|
177
|
+
.lp-notes .prose :global(h5) {
|
|
178
|
+
margin: 1.5rem 0 0.5rem;
|
|
179
|
+
font-family: var(--font-display);
|
|
180
|
+
font-size: var(--text-lg);
|
|
181
|
+
font-weight: 700;
|
|
182
|
+
line-height: 1.25;
|
|
183
|
+
}
|
|
184
|
+
.lp-notes .prose :global(h5) {
|
|
185
|
+
font-family: var(--font);
|
|
186
|
+
font-size: var(--text);
|
|
187
|
+
}
|
|
188
|
+
.lp-side {
|
|
189
|
+
align-self: start;
|
|
190
|
+
min-width: 0;
|
|
191
|
+
padding: 1.25rem;
|
|
192
|
+
border: 1px solid var(--line);
|
|
193
|
+
border-radius: var(--radius-card);
|
|
194
|
+
background: var(--surface);
|
|
195
|
+
}
|
|
196
|
+
.lp-side .lp-side-title {
|
|
197
|
+
margin: 0 0 0.75rem;
|
|
198
|
+
font-family: var(--font);
|
|
199
|
+
font-size: var(--text);
|
|
200
|
+
font-weight: 700;
|
|
201
|
+
letter-spacing: 0;
|
|
202
|
+
line-height: 1.3;
|
|
203
|
+
}
|
|
204
|
+
.lp-links {
|
|
205
|
+
display: grid;
|
|
206
|
+
gap: 0.25rem;
|
|
207
|
+
margin: 0;
|
|
208
|
+
padding: 0;
|
|
209
|
+
list-style: none;
|
|
210
|
+
}
|
|
211
|
+
.lp-links a {
|
|
212
|
+
display: grid;
|
|
213
|
+
grid-template-columns: 1.75rem minmax(0, 1fr);
|
|
214
|
+
gap: 0.625rem;
|
|
215
|
+
align-items: baseline;
|
|
216
|
+
min-height: 2.75rem;
|
|
217
|
+
padding: 0.625rem 0.75rem;
|
|
218
|
+
border-radius: var(--radius);
|
|
219
|
+
color: var(--ink);
|
|
220
|
+
font-size: var(--text-sm);
|
|
221
|
+
font-weight: 600;
|
|
222
|
+
line-height: 1.4;
|
|
223
|
+
text-decoration: none;
|
|
224
|
+
}
|
|
225
|
+
.lp-links a:hover {
|
|
226
|
+
background: color-mix(in srgb, var(--ink) 6%, transparent);
|
|
227
|
+
}
|
|
228
|
+
.lp-links a:hover .lp-link-label {
|
|
229
|
+
text-decoration: underline;
|
|
230
|
+
}
|
|
231
|
+
.lp-num {
|
|
232
|
+
color: var(--accent);
|
|
233
|
+
font-family: var(--font-display);
|
|
234
|
+
font-size: 1.125rem;
|
|
235
|
+
font-weight: 800;
|
|
236
|
+
line-height: 1;
|
|
237
|
+
font-variant-numeric: tabular-nums;
|
|
238
|
+
text-align: center;
|
|
239
|
+
}
|
|
240
|
+
.lp-link-label {
|
|
241
|
+
overflow-wrap: anywhere;
|
|
242
|
+
}
|
|
243
|
+
@media (min-width: 56rem) {
|
|
244
|
+
.lp-with-links {
|
|
245
|
+
grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
|
|
246
|
+
gap: 2rem;
|
|
247
|
+
align-items: start;
|
|
248
|
+
}
|
|
249
|
+
.lp-side {
|
|
250
|
+
position: sticky;
|
|
251
|
+
top: 1.5rem;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
</style>
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
---
|
|
2
|
+
// ContentPost · Theater (board 02, B, "Theater + tabs"): the piece's media
|
|
3
|
+
// across the whole column, as its entry page plays it (lesson.ts): a video
|
|
4
|
+
// in its player at 16:9, a podcast's audio in the browser's controls beside
|
|
5
|
+
// its cover, the hero alone when the piece has no media. Under it the
|
|
6
|
+
// section's heading as a kicker, the title (linking to the piece's page on
|
|
7
|
+
// this site) and its date, then two tabs: `notesLabel` ("Notes") over the
|
|
8
|
+
// piece's body, and `linksHeading` ("Resources" when blank) over the
|
|
9
|
+
// section's links as a list. Nothing here knows who is watching: no
|
|
10
|
+
// discussion, no transcript, no quiz.
|
|
11
|
+
//
|
|
12
|
+
// The tabs follow the ARIA tabs pattern (arrow keys, Home and End move
|
|
13
|
+
// between them) and are drawn hidden and shown by the section's script, so
|
|
14
|
+
// with scripts off both parts show one after the other under their own
|
|
15
|
+
// headings; with the script the headings are left to screen readers, the tab
|
|
16
|
+
// names them. With only notes or only links there is nothing to switch
|
|
17
|
+
// between and no tabs are drawn. With no piece baked the section draws
|
|
18
|
+
// nothing, as the Card layout does.
|
|
19
|
+
import type { ComponentProps } from 'astro/types'
|
|
20
|
+
import type Default from './index.astro'
|
|
21
|
+
import Band from '../Band.astro'
|
|
22
|
+
import { lessonOf } from './lesson'
|
|
23
|
+
import { idFor } from '../SampleBallot/ballot'
|
|
24
|
+
|
|
25
|
+
type Props = ComponentProps<typeof Default>
|
|
26
|
+
|
|
27
|
+
const { section } = Astro.props
|
|
28
|
+
const lesson = await lessonOf(section, Astro.locals.backgold)
|
|
29
|
+
const parts = lesson
|
|
30
|
+
? [
|
|
31
|
+
...(lesson.notes ? [{ key: 'notes', label: lesson.notesLabel }] : []),
|
|
32
|
+
...(lesson.links.length > 0 ? [{ key: 'links', label: lesson.linksHeading ?? 'Resources' }] : []),
|
|
33
|
+
]
|
|
34
|
+
: []
|
|
35
|
+
const tabs = parts.length > 1
|
|
36
|
+
const id = (key: string, what: string) => idFor(section, `theater-${key}-${what}`)
|
|
37
|
+
---
|
|
38
|
+
{lesson && (
|
|
39
|
+
<Band section={section} class="featured lesson-theater">
|
|
40
|
+
<div class="th">
|
|
41
|
+
{lesson.media?.kind === 'embed' && (
|
|
42
|
+
<div class="th-frame">
|
|
43
|
+
<iframe src={lesson.media.src} title={lesson.title} allow="encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe>
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
{lesson.media?.kind === 'video' && (
|
|
47
|
+
<div class="th-frame">
|
|
48
|
+
<video src={lesson.media.src} poster={lesson.media.poster ?? undefined} controls preload="none" playsinline>
|
|
49
|
+
<a href={lesson.media.src}>Watch the video</a>
|
|
50
|
+
</video>
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
{lesson.media?.kind === 'audio' && (
|
|
54
|
+
<div class="th-audio">
|
|
55
|
+
{lesson.media.cover && <img class="th-cover" src={lesson.media.cover} alt="" width="200" height="200" decoding="async" />}
|
|
56
|
+
<audio src={lesson.media.src} controls preload="none">
|
|
57
|
+
<a href={lesson.media.src}>Download the audio</a>
|
|
58
|
+
</audio>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
{lesson.media?.kind === 'image' && <img class="th-image" src={lesson.media.src} alt="" decoding="async" />}
|
|
62
|
+
<div class="th-head">
|
|
63
|
+
{lesson.kicker && <p class="kicker">{lesson.kicker}</p>}
|
|
64
|
+
<h2 class="th-title featured-title">{lesson.href ? <a href={lesson.href}>{lesson.title}</a> : lesson.title}</h2>
|
|
65
|
+
{lesson.day && lesson.date && <p class="fine"><time datetime={lesson.date}>{lesson.day}</time></p>}
|
|
66
|
+
</div>
|
|
67
|
+
{parts.length > 0 && (
|
|
68
|
+
<div class="th-parts" data-theater>
|
|
69
|
+
{tabs && (
|
|
70
|
+
<div class="th-tabs" role="tablist" aria-label={lesson.title} data-theater-tabs hidden>
|
|
71
|
+
{parts.map((part, i) => (
|
|
72
|
+
<button type="button" role="tab" id={id(part.key, 'tab')} aria-controls={id(part.key, 'panel')} aria-selected={i === 0 ? 'true' : 'false'} tabindex={i === 0 ? 0 : -1}>
|
|
73
|
+
{part.label}
|
|
74
|
+
{part.key === 'links' && <span class="th-count" aria-hidden="true">{lesson.links.length}</span>}
|
|
75
|
+
</button>
|
|
76
|
+
))}
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
{lesson.notes && (
|
|
80
|
+
<section class="th-panel" id={id('notes', 'panel')} data-theater-panel>
|
|
81
|
+
<h3 class="th-label">{lesson.notesLabel}</h3>
|
|
82
|
+
<div class="prose" set:html={lesson.notes} />
|
|
83
|
+
</section>
|
|
84
|
+
)}
|
|
85
|
+
{lesson.links.length > 0 && (
|
|
86
|
+
<section class="th-panel" id={id('links', 'panel')} data-theater-panel>
|
|
87
|
+
<h3 class="th-label">{lesson.linksHeading ?? 'Resources'}</h3>
|
|
88
|
+
<ul class="th-links" role="list">
|
|
89
|
+
{lesson.links.map((link) => (
|
|
90
|
+
<li><a href={link.href} rel={link.rel}>{link.label}</a></li>
|
|
91
|
+
))}
|
|
92
|
+
</ul>
|
|
93
|
+
</section>
|
|
94
|
+
)}
|
|
95
|
+
{tabs && (
|
|
96
|
+
<script is:inline>
|
|
97
|
+
;(function (root) {
|
|
98
|
+
if (!root) return
|
|
99
|
+
var list = root.querySelector('[data-theater-tabs]')
|
|
100
|
+
var tabs = list.querySelectorAll('[role="tab"]')
|
|
101
|
+
var panels = root.querySelectorAll('[data-theater-panel]')
|
|
102
|
+
var pick = function (index, focus) {
|
|
103
|
+
for (var t = 0; t < tabs.length; t++) {
|
|
104
|
+
var on = t === index
|
|
105
|
+
tabs[t].setAttribute('aria-selected', on ? 'true' : 'false')
|
|
106
|
+
tabs[t].tabIndex = on ? 0 : -1
|
|
107
|
+
panels[t].hidden = !on
|
|
108
|
+
}
|
|
109
|
+
if (focus) tabs[index].focus()
|
|
110
|
+
}
|
|
111
|
+
for (var t = 0; t < tabs.length; t++) {
|
|
112
|
+
panels[t].setAttribute('role', 'tabpanel')
|
|
113
|
+
panels[t].setAttribute('aria-labelledby', tabs[t].id)
|
|
114
|
+
panels[t].tabIndex = 0
|
|
115
|
+
tabs[t].addEventListener('click', function (event) {
|
|
116
|
+
pick(Array.prototype.indexOf.call(tabs, event.currentTarget), false)
|
|
117
|
+
})
|
|
118
|
+
tabs[t].addEventListener('keydown', function (event) {
|
|
119
|
+
var at = Array.prototype.indexOf.call(tabs, event.currentTarget)
|
|
120
|
+
var to = event.key === 'ArrowRight' ? at + 1 : event.key === 'ArrowLeft' ? at - 1 : event.key === 'Home' ? 0 : event.key === 'End' ? tabs.length - 1 : null
|
|
121
|
+
if (to === null) return
|
|
122
|
+
event.preventDefault()
|
|
123
|
+
pick((to + tabs.length) % tabs.length, true)
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
list.hidden = false
|
|
127
|
+
root.setAttribute('data-theater-live', '')
|
|
128
|
+
pick(0, false)
|
|
129
|
+
})(document.currentScript.closest('[data-theater]'))
|
|
130
|
+
</script>
|
|
131
|
+
)}
|
|
132
|
+
</div>
|
|
133
|
+
)}
|
|
134
|
+
</div>
|
|
135
|
+
</Band>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
<style>
|
|
139
|
+
.th {
|
|
140
|
+
display: grid;
|
|
141
|
+
gap: 1.25rem;
|
|
142
|
+
min-width: 0;
|
|
143
|
+
}
|
|
144
|
+
.th > * {
|
|
145
|
+
margin: 0;
|
|
146
|
+
}
|
|
147
|
+
.th-frame {
|
|
148
|
+
position: relative;
|
|
149
|
+
aspect-ratio: 16 / 9;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
border-radius: var(--radius);
|
|
152
|
+
background: color-mix(in srgb, var(--ink) 12%, transparent);
|
|
153
|
+
}
|
|
154
|
+
.th-frame iframe,
|
|
155
|
+
.th-frame video {
|
|
156
|
+
display: block;
|
|
157
|
+
width: 100%;
|
|
158
|
+
height: 100%;
|
|
159
|
+
border: 0;
|
|
160
|
+
}
|
|
161
|
+
.th-audio {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-wrap: wrap;
|
|
164
|
+
align-items: center;
|
|
165
|
+
gap: 1rem 1.75rem;
|
|
166
|
+
padding: 1.5rem;
|
|
167
|
+
border: 1px solid var(--line);
|
|
168
|
+
border-radius: var(--radius-card);
|
|
169
|
+
background: var(--surface);
|
|
170
|
+
}
|
|
171
|
+
.th-cover {
|
|
172
|
+
width: 8rem;
|
|
173
|
+
height: 8rem;
|
|
174
|
+
border-radius: calc(var(--radius) / 1.5);
|
|
175
|
+
object-fit: cover;
|
|
176
|
+
}
|
|
177
|
+
.th-audio audio {
|
|
178
|
+
flex: 1 1 18rem;
|
|
179
|
+
min-width: 0;
|
|
180
|
+
width: 100%;
|
|
181
|
+
}
|
|
182
|
+
.th-image {
|
|
183
|
+
display: block;
|
|
184
|
+
width: 100%;
|
|
185
|
+
aspect-ratio: 21 / 9;
|
|
186
|
+
border-radius: var(--radius);
|
|
187
|
+
object-fit: cover;
|
|
188
|
+
}
|
|
189
|
+
.th-head > * {
|
|
190
|
+
margin: 0;
|
|
191
|
+
}
|
|
192
|
+
.th-head .kicker {
|
|
193
|
+
margin-bottom: 0.5rem;
|
|
194
|
+
}
|
|
195
|
+
.th-head .th-title {
|
|
196
|
+
font-size: calc(var(--h2) * 0.8);
|
|
197
|
+
line-height: 1.12;
|
|
198
|
+
}
|
|
199
|
+
.th-head .fine {
|
|
200
|
+
margin-top: 0.375rem;
|
|
201
|
+
}
|
|
202
|
+
.th-parts {
|
|
203
|
+
display: grid;
|
|
204
|
+
gap: 1.75rem;
|
|
205
|
+
min-width: 0;
|
|
206
|
+
}
|
|
207
|
+
[data-theater-live].th-parts {
|
|
208
|
+
gap: 1.25rem;
|
|
209
|
+
}
|
|
210
|
+
.th-tabs[hidden],
|
|
211
|
+
.th-panel[hidden] {
|
|
212
|
+
display: none;
|
|
213
|
+
}
|
|
214
|
+
.th-tabs {
|
|
215
|
+
display: flex;
|
|
216
|
+
gap: 0.25rem 1.5rem;
|
|
217
|
+
overflow-x: auto;
|
|
218
|
+
border-bottom: 1px solid var(--line);
|
|
219
|
+
scrollbar-width: none;
|
|
220
|
+
}
|
|
221
|
+
.th-tabs button {
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
flex: 0 0 auto;
|
|
224
|
+
align-items: center;
|
|
225
|
+
gap: 0.5rem;
|
|
226
|
+
min-height: 2.75rem;
|
|
227
|
+
margin-bottom: -1px;
|
|
228
|
+
padding: 0.5rem 0.125rem;
|
|
229
|
+
border: 0;
|
|
230
|
+
border-bottom: 3px solid transparent;
|
|
231
|
+
background: transparent;
|
|
232
|
+
color: var(--muted);
|
|
233
|
+
font: inherit;
|
|
234
|
+
font-size: var(--text);
|
|
235
|
+
font-weight: 600;
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
}
|
|
238
|
+
.th-tabs button:hover {
|
|
239
|
+
color: var(--ink);
|
|
240
|
+
}
|
|
241
|
+
.th-tabs button[aria-selected='true'] {
|
|
242
|
+
border-bottom-color: var(--accent);
|
|
243
|
+
color: var(--ink);
|
|
244
|
+
font-weight: 700;
|
|
245
|
+
}
|
|
246
|
+
.th-tabs button:focus-visible {
|
|
247
|
+
outline-offset: -3px;
|
|
248
|
+
}
|
|
249
|
+
.th-count {
|
|
250
|
+
padding: 0 0.4375rem;
|
|
251
|
+
border-radius: var(--pill);
|
|
252
|
+
background: color-mix(in srgb, var(--ink) 8%, transparent);
|
|
253
|
+
font-size: var(--text-xs);
|
|
254
|
+
font-weight: 700;
|
|
255
|
+
line-height: 1.6;
|
|
256
|
+
}
|
|
257
|
+
.th-panel {
|
|
258
|
+
min-width: 0;
|
|
259
|
+
}
|
|
260
|
+
.th-panel:focus-visible {
|
|
261
|
+
outline-offset: 6px;
|
|
262
|
+
}
|
|
263
|
+
.th-label {
|
|
264
|
+
margin: 0 0 0.75rem;
|
|
265
|
+
font-size: calc(var(--h3) * 0.85);
|
|
266
|
+
font-weight: 700;
|
|
267
|
+
line-height: 1.25;
|
|
268
|
+
}
|
|
269
|
+
/* With the tabs, the tab names the part; its heading is left to screen readers. */
|
|
270
|
+
[data-theater-live] .th-label {
|
|
271
|
+
position: absolute;
|
|
272
|
+
width: 1px;
|
|
273
|
+
height: 1px;
|
|
274
|
+
margin: -1px;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
clip: rect(0 0 0 0);
|
|
277
|
+
white-space: nowrap;
|
|
278
|
+
}
|
|
279
|
+
.th-panel .prose > :global(:first-child) {
|
|
280
|
+
margin-top: 0;
|
|
281
|
+
}
|
|
282
|
+
.th-panel .prose > :global(:last-child) {
|
|
283
|
+
margin-bottom: 0;
|
|
284
|
+
}
|
|
285
|
+
/* The body's headings, moved under the part's own (lesson.ts). */
|
|
286
|
+
.th-panel .prose :global(h4),
|
|
287
|
+
.th-panel .prose :global(h5) {
|
|
288
|
+
margin: 1.5rem 0 0.5rem;
|
|
289
|
+
font-family: var(--font-display);
|
|
290
|
+
font-size: var(--text-lg);
|
|
291
|
+
font-weight: 700;
|
|
292
|
+
line-height: 1.25;
|
|
293
|
+
}
|
|
294
|
+
.th-panel .prose :global(h5) {
|
|
295
|
+
font-family: var(--font);
|
|
296
|
+
font-size: var(--text);
|
|
297
|
+
}
|
|
298
|
+
.th-links {
|
|
299
|
+
display: grid;
|
|
300
|
+
gap: 0.5rem;
|
|
301
|
+
max-width: var(--measure);
|
|
302
|
+
margin: 0;
|
|
303
|
+
padding: 0;
|
|
304
|
+
list-style: none;
|
|
305
|
+
}
|
|
306
|
+
.th-links a {
|
|
307
|
+
display: flex;
|
|
308
|
+
align-items: center;
|
|
309
|
+
min-height: 2.75rem;
|
|
310
|
+
padding: 0.625rem 1rem;
|
|
311
|
+
border: 1px solid var(--line);
|
|
312
|
+
border-radius: var(--radius);
|
|
313
|
+
background: var(--surface);
|
|
314
|
+
color: var(--ink);
|
|
315
|
+
font-weight: 600;
|
|
316
|
+
line-height: 1.4;
|
|
317
|
+
text-decoration: none;
|
|
318
|
+
overflow-wrap: anywhere;
|
|
319
|
+
}
|
|
320
|
+
.th-links a:hover {
|
|
321
|
+
border-color: var(--line-strong);
|
|
322
|
+
text-decoration: underline;
|
|
323
|
+
}
|
|
324
|
+
@media (min-width: 48rem) {
|
|
325
|
+
.th {
|
|
326
|
+
gap: 1.5rem;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Countdown: the eyebrow over the heading, the body line under it with the
|
|
3
|
+
// section's link after it (C1's "Find where to vote"), and the time left
|
|
4
|
+
// until the deadline; each part drawn only when the section has it. Pages are
|
|
5
|
+
// cached until content changes, so the server writes the deadline itself and
|
|
6
|
+
// a few lines of script count the days in the visitor's browser; without
|
|
7
|
+
// script the deadline still reads plainly.
|
|
8
|
+
import type { Section } from '@backgold/content'
|
|
9
|
+
import Band from '../Band.astro'
|
|
10
|
+
import { links, rows } from '../../../lib/section'
|
|
11
|
+
import { formatWhen, text } from '../../../lib/format'
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
section: Section
|
|
15
|
+
variant?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { section } = Astro.props
|
|
19
|
+
const eyebrow = text(section.copy.eyebrow)
|
|
20
|
+
const heading = text(section.copy.heading)
|
|
21
|
+
const body = text(section.copy.body)
|
|
22
|
+
const [link] = links(section)
|
|
23
|
+
const deadline = text(rows(section)[0]?.deadline)
|
|
24
|
+
const when = formatWhen(deadline)
|
|
25
|
+
---
|
|
26
|
+
{deadline && when && (
|
|
27
|
+
<Band section={section} class="countdown">
|
|
28
|
+
{eyebrow && <p class="kicker">{eyebrow}</p>}
|
|
29
|
+
{heading && <h2>{heading}</h2>}
|
|
30
|
+
{(body || link) && (
|
|
31
|
+
<p class="countdown-body">
|
|
32
|
+
{body}{body && link && ' '}{link && <a class="text-link" href={link.href} rel={link.rel}>{link.label}</a>}
|
|
33
|
+
</p>
|
|
34
|
+
)}
|
|
35
|
+
<p class="countdown-left" data-countdown={deadline}>Until <time datetime={deadline}>{when}</time></p>
|
|
36
|
+
<script is:inline>
|
|
37
|
+
(function (el) {
|
|
38
|
+
var end = Date.parse(el.getAttribute('data-countdown'))
|
|
39
|
+
if (isNaN(end)) return
|
|
40
|
+
var ms = end - Date.now()
|
|
41
|
+
if (ms <= 0) return
|
|
42
|
+
var days = Math.floor(ms / 86400000)
|
|
43
|
+
var hours = Math.floor((ms % 86400000) / 3600000)
|
|
44
|
+
var left = days > 0 ? days + (days === 1 ? ' day' : ' days') : hours + (hours === 1 ? ' hour' : ' hours')
|
|
45
|
+
var strong = document.createElement('strong')
|
|
46
|
+
strong.className = 'countdown-number'
|
|
47
|
+
strong.textContent = left
|
|
48
|
+
el.firstChild.textContent = ' left, until '
|
|
49
|
+
el.prepend(strong)
|
|
50
|
+
})(document.currentScript.previousElementSibling)
|
|
51
|
+
</script>
|
|
52
|
+
</Band>
|
|
53
|
+
)}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A course's bar (boards D1, D2, D3): a real <progress> at the visitor's
|
|
3
|
+
// lessons finished of the course's lessons, drawn at its value (it never
|
|
4
|
+
// fills up on load). `label` names it for a screen reader ("Foundational
|
|
5
|
+
// Leadership: 4 of 12 lessons"); the words beside it are the layout's.
|
|
6
|
+
interface Props {
|
|
7
|
+
completed: number
|
|
8
|
+
total: number
|
|
9
|
+
label: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { completed, total, label } = Astro.props
|
|
13
|
+
const max = Math.max(total, 1)
|
|
14
|
+
---
|
|
15
|
+
<progress class="ac-bar" max={max} value={Math.min(completed, max)} aria-label={label}>{completed} of {total}</progress>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.ac-bar {
|
|
19
|
+
display: block;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 0.5rem;
|
|
22
|
+
border: 0;
|
|
23
|
+
border-radius: var(--pill);
|
|
24
|
+
background: color-mix(in srgb, var(--ink) 14%, transparent);
|
|
25
|
+
color: var(--button);
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
appearance: none;
|
|
28
|
+
}
|
|
29
|
+
.ac-bar::-webkit-progress-bar {
|
|
30
|
+
border-radius: var(--pill);
|
|
31
|
+
background: color-mix(in srgb, var(--ink) 14%, transparent);
|
|
32
|
+
}
|
|
33
|
+
.ac-bar::-webkit-progress-value {
|
|
34
|
+
border-radius: var(--pill);
|
|
35
|
+
background: var(--button);
|
|
36
|
+
}
|
|
37
|
+
.ac-bar::-moz-progress-bar {
|
|
38
|
+
border-radius: var(--pill);
|
|
39
|
+
background: var(--button);
|
|
40
|
+
}
|
|
41
|
+
@media (forced-colors: active) {
|
|
42
|
+
.ac-bar {
|
|
43
|
+
border: 1px solid CanvasText;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|