@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,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Portfolio · Strip: the kicker and heading, the body, then the work in one
|
|
3
|
+
// row that scrolls sideways, the featured layout's thumbnails on their own
|
|
4
|
+
// at a size to read: each piece its picture at 3:2 (or, with none, its
|
|
5
|
+
// title large on a panel of the band's surface), then its title (a link to
|
|
6
|
+
// its page, or to its picture when it has no page) and its kind in small
|
|
7
|
+
// capitals under it. About three and a half pieces show on a wide screen,
|
|
8
|
+
// so the next one is always in view at the edge; a phone shows one and a
|
|
9
|
+
// little of the next. The row snaps to a piece's edge, takes the keyboard's
|
|
10
|
+
// arrow keys when it has focus, and keeps the browser's own scroll bar. No
|
|
11
|
+
// script. Nothing is drawn with no work and no heading.
|
|
12
|
+
import type { ComponentProps } from 'astro/types'
|
|
13
|
+
import type Default from './index.astro'
|
|
14
|
+
import Band from '../Band.astro'
|
|
15
|
+
import SectionHead from '../SectionHead.astro'
|
|
16
|
+
import Prose from '../../Prose.astro'
|
|
17
|
+
import { text } from '../../../lib/format'
|
|
18
|
+
import { targetOf, workOf } from './work'
|
|
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 work = workOf(section)
|
|
26
|
+
---
|
|
27
|
+
{(heading || work.length > 0) && (
|
|
28
|
+
<Band section={section} class="portfolio portfolio-strip">
|
|
29
|
+
<SectionHead kicker={kicker} heading={heading} more={[]} />
|
|
30
|
+
<Prose value={section.copy.body} class="lede" />
|
|
31
|
+
{work.length > 0 && (
|
|
32
|
+
<ul class="strip" role="list" tabindex="0" aria-label={heading ?? 'Our work'}>
|
|
33
|
+
{work.map((piece) => {
|
|
34
|
+
const target = targetOf(piece)
|
|
35
|
+
return (
|
|
36
|
+
<li class="strip-card">
|
|
37
|
+
<div class:list={['strip-frame', !piece.pictures[0] && 'strip-frame-words']}>
|
|
38
|
+
{piece.pictures[0] ? (
|
|
39
|
+
<img class="strip-photo" src={piece.pictures[0]} alt="" loading="lazy" decoding="async" />
|
|
40
|
+
) : (
|
|
41
|
+
<p class="strip-frame-title" aria-hidden="true">{piece.title}</p>
|
|
42
|
+
)}
|
|
43
|
+
</div>
|
|
44
|
+
<h3 class="strip-title">{target ? <a href={target.href} rel={target.rel}>{piece.title}</a> : piece.title}</h3>
|
|
45
|
+
{piece.kind && <p class="strip-kind">{piece.kind}</p>}
|
|
46
|
+
</li>
|
|
47
|
+
)
|
|
48
|
+
})}
|
|
49
|
+
</ul>
|
|
50
|
+
)}
|
|
51
|
+
</Band>
|
|
52
|
+
)}
|
|
53
|
+
|
|
54
|
+
<style>
|
|
55
|
+
/* The padding keeps a focused card's ring inside the scroll box. */
|
|
56
|
+
.strip {
|
|
57
|
+
display: flex;
|
|
58
|
+
gap: 1rem;
|
|
59
|
+
margin: 0 -0.375rem;
|
|
60
|
+
padding: 0.375rem 0.375rem 1rem;
|
|
61
|
+
list-style: none;
|
|
62
|
+
overflow-x: auto;
|
|
63
|
+
scroll-snap-type: x mandatory;
|
|
64
|
+
scroll-padding-inline: 0.375rem;
|
|
65
|
+
overscroll-behavior-x: contain;
|
|
66
|
+
}
|
|
67
|
+
.strip:focus-visible {
|
|
68
|
+
outline: 3px solid var(--ink);
|
|
69
|
+
outline-offset: 2px;
|
|
70
|
+
border-radius: var(--radius);
|
|
71
|
+
}
|
|
72
|
+
.strip-card {
|
|
73
|
+
position: relative;
|
|
74
|
+
flex: 0 0 78%;
|
|
75
|
+
min-width: 0;
|
|
76
|
+
scroll-snap-align: start;
|
|
77
|
+
border-radius: var(--radius-card);
|
|
78
|
+
}
|
|
79
|
+
.strip-card > p,
|
|
80
|
+
.strip-card > h3 {
|
|
81
|
+
margin: 0;
|
|
82
|
+
}
|
|
83
|
+
.strip-frame {
|
|
84
|
+
aspect-ratio: 3 / 2;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
border-radius: var(--radius-card);
|
|
87
|
+
background: color-mix(in srgb, var(--ink) 6%, transparent);
|
|
88
|
+
}
|
|
89
|
+
.strip-photo {
|
|
90
|
+
display: block;
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
object-fit: cover;
|
|
94
|
+
}
|
|
95
|
+
.strip-frame-words {
|
|
96
|
+
display: grid;
|
|
97
|
+
place-items: center;
|
|
98
|
+
padding: 1.25rem;
|
|
99
|
+
border: 1px solid var(--line);
|
|
100
|
+
background: var(--surface);
|
|
101
|
+
box-shadow: inset 0 -3px 0 var(--accent);
|
|
102
|
+
}
|
|
103
|
+
.strip-frame-title {
|
|
104
|
+
margin: 0;
|
|
105
|
+
font-family: var(--font-display);
|
|
106
|
+
font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.875rem);
|
|
107
|
+
font-weight: 800;
|
|
108
|
+
line-height: 1.08;
|
|
109
|
+
letter-spacing: -0.02em;
|
|
110
|
+
text-align: center;
|
|
111
|
+
text-wrap: balance;
|
|
112
|
+
overflow-wrap: anywhere;
|
|
113
|
+
}
|
|
114
|
+
.strip-card .strip-title {
|
|
115
|
+
margin-top: 0.75rem;
|
|
116
|
+
font-size: calc(var(--h3) * 0.85);
|
|
117
|
+
font-weight: 700;
|
|
118
|
+
line-height: 1.2;
|
|
119
|
+
}
|
|
120
|
+
.strip-title a {
|
|
121
|
+
color: var(--ink);
|
|
122
|
+
text-decoration: none;
|
|
123
|
+
}
|
|
124
|
+
/* The title's link covers the card. */
|
|
125
|
+
.strip-title a::after {
|
|
126
|
+
content: '';
|
|
127
|
+
position: absolute;
|
|
128
|
+
inset: 0;
|
|
129
|
+
border-radius: var(--radius-card);
|
|
130
|
+
}
|
|
131
|
+
.strip-card:hover .strip-title a {
|
|
132
|
+
text-decoration: underline;
|
|
133
|
+
}
|
|
134
|
+
.strip-card:focus-within {
|
|
135
|
+
outline: 3px solid var(--ink);
|
|
136
|
+
outline-offset: 3px;
|
|
137
|
+
}
|
|
138
|
+
.strip-title a:focus-visible {
|
|
139
|
+
outline: none;
|
|
140
|
+
}
|
|
141
|
+
.strip-card .strip-kind {
|
|
142
|
+
margin-top: 0.25rem;
|
|
143
|
+
color: var(--muted);
|
|
144
|
+
font-size: var(--text-xs);
|
|
145
|
+
font-weight: 700;
|
|
146
|
+
letter-spacing: 0.12em;
|
|
147
|
+
text-transform: uppercase;
|
|
148
|
+
}
|
|
149
|
+
@media (min-width: 40rem) {
|
|
150
|
+
.strip-card {
|
|
151
|
+
flex-basis: 44%;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
@media (min-width: 56rem) {
|
|
155
|
+
.strip {
|
|
156
|
+
gap: 1.25rem;
|
|
157
|
+
}
|
|
158
|
+
.strip-card {
|
|
159
|
+
flex-basis: calc((100% - 3 * 1.25rem) / 3.4);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
163
|
+
.strip {
|
|
164
|
+
scroll-behavior: smooth;
|
|
165
|
+
}
|
|
166
|
+
.strip-photo {
|
|
167
|
+
transition: transform 0.3s ease;
|
|
168
|
+
}
|
|
169
|
+
.strip-card:hover .strip-photo {
|
|
170
|
+
transform: scale(1.03);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// A Portfolio section's work as its layouts draw it: the rows of the
|
|
2
|
+
// authored list (`work`, prop `items`), in row order, the first 24. Each
|
|
3
|
+
// piece reads `title`, `kind` (a short word: "Mail", "Video", "Brand"),
|
|
4
|
+
// `client`, `year`, `summary`, `role`, `result`, its picture (`imageUrl`),
|
|
5
|
+
// the more pictures a lightbox shows (`images`, a list of addresses) and
|
|
6
|
+
// its page (`href`). A row without a title is not a piece of work.
|
|
7
|
+
//
|
|
8
|
+
// Every address is checked as the siblings check theirs: a picture with an
|
|
9
|
+
// unsafe or missing address is left out, and so is a link. A piece's
|
|
10
|
+
// pictures are its own picture first, then `images`, each once.
|
|
11
|
+
//
|
|
12
|
+
// `clientLabel` ("Client") prefixes the client wherever a layout shows it
|
|
13
|
+
// ("Client: A State House campaign"); without it the client stands alone.
|
|
14
|
+
|
|
15
|
+
import type { Section } from '@backgold/content'
|
|
16
|
+
import { relFor, safeSrc } from '@backgold/astro/server'
|
|
17
|
+
import { linkOf, rows, type Link } from '../../../lib/section'
|
|
18
|
+
import { text } from '../../../lib/format'
|
|
19
|
+
|
|
20
|
+
const MAX = 24
|
|
21
|
+
|
|
22
|
+
export interface Work {
|
|
23
|
+
title: string
|
|
24
|
+
kind: string | null
|
|
25
|
+
client: string | null
|
|
26
|
+
year: string | null
|
|
27
|
+
summary: string | null
|
|
28
|
+
role: string | null
|
|
29
|
+
result: string | null
|
|
30
|
+
/** The piece's picture and its more pictures, safe addresses, each once. */
|
|
31
|
+
pictures: string[]
|
|
32
|
+
/** The piece's page, when the row has a safe address for it. */
|
|
33
|
+
link: Link | null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A short field: trimmed text, or a number written as text (a year typed as 2024). */
|
|
37
|
+
function short(value: unknown): string | null {
|
|
38
|
+
if (typeof value === 'number' && Number.isFinite(value)) return String(value)
|
|
39
|
+
return text(value)?.trim() ?? null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The section's work in row order: the first 24 rows that have a title. */
|
|
43
|
+
export function workOf(section: Section): Work[] {
|
|
44
|
+
return rows(section)
|
|
45
|
+
.flatMap((row) => {
|
|
46
|
+
const title = short(row.title)
|
|
47
|
+
if (!title) return []
|
|
48
|
+
const more = Array.isArray(row.images) ? row.images : []
|
|
49
|
+
const pictures = [...new Set([row.imageUrl, ...more].map((url) => safeSrc(url)).filter((url): url is string => !!url))]
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
title,
|
|
53
|
+
kind: short(row.kind),
|
|
54
|
+
client: short(row.client),
|
|
55
|
+
year: short(row.year),
|
|
56
|
+
summary: text(row.summary),
|
|
57
|
+
role: text(row.role),
|
|
58
|
+
result: text(row.result),
|
|
59
|
+
pictures,
|
|
60
|
+
link: linkOf(title, row.href),
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
.slice(0, MAX)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The kinds the work names, each once, in the order the rows first name them. */
|
|
68
|
+
export function kindsOf(work: Work[]): string[] {
|
|
69
|
+
return [...new Set(work.map((w) => w.kind).filter((kind): kind is string => kind !== null))]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** "Client: A State House campaign", or the client alone without a label; null with no client. */
|
|
73
|
+
export function clientOf(work: Work, clientLabel: string | null): string | null {
|
|
74
|
+
if (!work.client) return null
|
|
75
|
+
return clientLabel ? `${clientLabel}: ${work.client}` : work.client
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** "Client: A State House campaign · 2024", the parts a piece has; null with neither. */
|
|
79
|
+
export function creditOf(work: Work, clientLabel: string | null): string | null {
|
|
80
|
+
return [clientOf(work, clientLabel), work.year].filter(Boolean).join(' · ') || null
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** "Mail · 2024", the parts a piece has; null with neither. */
|
|
84
|
+
export function kindAndYear(work: Work): string | null {
|
|
85
|
+
return [work.kind, work.year].filter(Boolean).join(' · ') || null
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Where a piece goes without script: its page, else its first picture, else
|
|
90
|
+
* nowhere (null).
|
|
91
|
+
*/
|
|
92
|
+
export function targetOf(work: Work): { href: string; rel: 'noopener' | undefined } | null {
|
|
93
|
+
if (work.link) return { href: work.link.href, rel: work.link.rel }
|
|
94
|
+
return work.pictures[0] ? { href: work.pictures[0], rel: relFor(work.pictures[0]) } : null
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** An id unique to the section, for aria-controls and labels. */
|
|
98
|
+
export function idFor(section: Section, suffix: string): string {
|
|
99
|
+
return `${section.id}-${suffix}`.replace(/[^A-Za-z0-9_-]/g, '-')
|
|
100
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The end of a Progress section's match, for the layouts that draw it. The
|
|
3
|
+
// server writes the end as a plain line ("Ends Sunday, October 18, 2026 at
|
|
4
|
+
// 11:59 PM"), which is what a visitor without script reads. With `tiles`
|
|
5
|
+
// (the default) a few lines of script count the time left down each second
|
|
6
|
+
// in the visitor's browser as four tiles, days, hours, minutes and seconds,
|
|
7
|
+
// the plain line kept for screen readers; without `tiles` the plain line
|
|
8
|
+
// stays and nothing ticks. Pages are cached until content changes, so once
|
|
9
|
+
// the end has passed in the visitor's browser the clock reads "The match has
|
|
10
|
+
// ended" and every `[data-match-chip]` in the section (the "2× match" words)
|
|
11
|
+
// goes. `until` is the end as the section stores it, `ends` as formatWhen
|
|
12
|
+
// writes it; the caller draws the clock only for an end that is a date.
|
|
13
|
+
interface Props {
|
|
14
|
+
until: string
|
|
15
|
+
ends: string
|
|
16
|
+
tiles?: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const { until, ends, tiles = true } = Astro.props
|
|
20
|
+
const units = [
|
|
21
|
+
{ key: 'days', label: 'days' },
|
|
22
|
+
{ key: 'hours', label: 'hrs' },
|
|
23
|
+
{ key: 'minutes', label: 'min' },
|
|
24
|
+
{ key: 'seconds', label: 'sec' },
|
|
25
|
+
]
|
|
26
|
+
---
|
|
27
|
+
{tiles ? (
|
|
28
|
+
<>
|
|
29
|
+
<div class="match-clock" data-match-until={until}>
|
|
30
|
+
<div class="match-left" aria-live="off" data-match-left hidden>
|
|
31
|
+
<p class="visually-hidden">Ends {ends}</p>
|
|
32
|
+
<ol class="match-tiles" role="list" aria-hidden="true">
|
|
33
|
+
{units.map((unit) => (
|
|
34
|
+
<li class="match-tile">
|
|
35
|
+
<span class="match-number" data-match-unit={unit.key}></span>
|
|
36
|
+
<span class="match-unit">{unit.label}</span>
|
|
37
|
+
</li>
|
|
38
|
+
))}
|
|
39
|
+
</ol>
|
|
40
|
+
</div>
|
|
41
|
+
<p class="match-ends" data-match-ends>Ends <time datetime={until}>{ends}</time></p>
|
|
42
|
+
<p class="match-over" data-match-over hidden>The match has ended</p>
|
|
43
|
+
</div>
|
|
44
|
+
<script is:inline>
|
|
45
|
+
(function (clock) {
|
|
46
|
+
var end = Date.parse(clock.getAttribute('data-match-until'))
|
|
47
|
+
if (isNaN(end)) return
|
|
48
|
+
var left = clock.querySelector('[data-match-left]')
|
|
49
|
+
var plain = clock.querySelector('[data-match-ends]')
|
|
50
|
+
var over = clock.querySelector('[data-match-over]')
|
|
51
|
+
var card = clock.closest('.bg-section')
|
|
52
|
+
var chip = card && card.querySelector('[data-match-chip]')
|
|
53
|
+
var slots = {}
|
|
54
|
+
clock.querySelectorAll('[data-match-unit]').forEach(function (slot) {
|
|
55
|
+
slots[slot.getAttribute('data-match-unit')] = slot
|
|
56
|
+
})
|
|
57
|
+
function two(n) {
|
|
58
|
+
return n < 10 ? '0' + n : String(n)
|
|
59
|
+
}
|
|
60
|
+
function tick() {
|
|
61
|
+
var ms = end - Date.now()
|
|
62
|
+
if (ms <= 0) {
|
|
63
|
+
left.hidden = true
|
|
64
|
+
plain.hidden = true
|
|
65
|
+
over.hidden = false
|
|
66
|
+
if (chip) chip.hidden = true
|
|
67
|
+
return false
|
|
68
|
+
}
|
|
69
|
+
var s = Math.floor(ms / 1000)
|
|
70
|
+
slots.days.textContent = two(Math.floor(s / 86400))
|
|
71
|
+
slots.hours.textContent = two(Math.floor((s % 86400) / 3600))
|
|
72
|
+
slots.minutes.textContent = two(Math.floor((s % 3600) / 60))
|
|
73
|
+
slots.seconds.textContent = two(s % 60)
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
if (!tick()) return
|
|
77
|
+
plain.hidden = true
|
|
78
|
+
left.hidden = false
|
|
79
|
+
var timer = setInterval(function () {
|
|
80
|
+
if (!tick()) clearInterval(timer)
|
|
81
|
+
}, 1000)
|
|
82
|
+
})(document.currentScript.previousElementSibling)
|
|
83
|
+
</script>
|
|
84
|
+
</>
|
|
85
|
+
) : (
|
|
86
|
+
<>
|
|
87
|
+
<div class="match-clock match-clock-plain" data-match-until={until}>
|
|
88
|
+
<p class="match-ends" data-match-ends>Ends <time datetime={until}>{ends}</time></p>
|
|
89
|
+
<p class="match-over" data-match-over hidden>The match has ended</p>
|
|
90
|
+
</div>
|
|
91
|
+
<script is:inline>
|
|
92
|
+
(function (clock) {
|
|
93
|
+
var end = Date.parse(clock.getAttribute('data-match-until'))
|
|
94
|
+
if (isNaN(end)) return
|
|
95
|
+
var plain = clock.querySelector('[data-match-ends]')
|
|
96
|
+
var over = clock.querySelector('[data-match-over]')
|
|
97
|
+
var card = clock.closest('.bg-section')
|
|
98
|
+
function close() {
|
|
99
|
+
plain.hidden = true
|
|
100
|
+
over.hidden = false
|
|
101
|
+
if (card) {
|
|
102
|
+
card.querySelectorAll('[data-match-chip]').forEach(function (chip) {
|
|
103
|
+
chip.hidden = true
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var ms = end - Date.now()
|
|
108
|
+
if (ms <= 0) close()
|
|
109
|
+
else if (ms < 2147483647) setTimeout(close, ms)
|
|
110
|
+
})(document.currentScript.previousElementSibling)
|
|
111
|
+
</script>
|
|
112
|
+
</>
|
|
113
|
+
)}
|
|
114
|
+
|
|
115
|
+
<style>
|
|
116
|
+
.match-clock p {
|
|
117
|
+
margin: 0;
|
|
118
|
+
}
|
|
119
|
+
.match-left[hidden],
|
|
120
|
+
.match-ends[hidden],
|
|
121
|
+
.match-over[hidden] {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
.match-tiles {
|
|
125
|
+
display: grid;
|
|
126
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
127
|
+
gap: 0.5rem;
|
|
128
|
+
margin: 0;
|
|
129
|
+
padding: 0;
|
|
130
|
+
list-style: none;
|
|
131
|
+
}
|
|
132
|
+
.match-tile {
|
|
133
|
+
display: grid;
|
|
134
|
+
justify-items: center;
|
|
135
|
+
gap: 0.25rem;
|
|
136
|
+
padding: 0.75rem 0.25rem 0.625rem;
|
|
137
|
+
border-radius: var(--radius);
|
|
138
|
+
background: var(--button-2);
|
|
139
|
+
color: var(--button-2-ink);
|
|
140
|
+
}
|
|
141
|
+
.match-number {
|
|
142
|
+
font-family: var(--font-display);
|
|
143
|
+
font-size: clamp(1.625rem, 1.35rem + 1vw, 2.125rem);
|
|
144
|
+
font-weight: 800;
|
|
145
|
+
font-variant-numeric: lining-nums tabular-nums;
|
|
146
|
+
line-height: 1;
|
|
147
|
+
letter-spacing: -0.02em;
|
|
148
|
+
}
|
|
149
|
+
.match-unit {
|
|
150
|
+
font-size: var(--text-xs);
|
|
151
|
+
font-weight: 600;
|
|
152
|
+
line-height: 1.2;
|
|
153
|
+
}
|
|
154
|
+
.match-ends,
|
|
155
|
+
.match-over {
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
}
|
|
158
|
+
.match-over {
|
|
159
|
+
color: var(--muted);
|
|
160
|
+
}
|
|
161
|
+
.match-clock-plain .match-ends,
|
|
162
|
+
.match-clock-plain .match-over {
|
|
163
|
+
font-weight: inherit;
|
|
164
|
+
color: inherit;
|
|
165
|
+
}
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Progress, 'compact' layout: one line on a wash panel. The heading, smaller,
|
|
3
|
+
// above it when the section has one; then the figures as BackGold last
|
|
4
|
+
// counted them when the page was published ("$18,400 raised", then "of a
|
|
5
|
+
// $50,000 goal" muted), a thin bar across the middle at the share of the goal
|
|
6
|
+
// raised with the percent after it, and the one button, the section's donate
|
|
7
|
+
// link under its own label, at the end. Under the line, when the section has
|
|
8
|
+
// a kicker or a match multiplier, one muted line: the kicker (else "2×
|
|
9
|
+
// match") and the end of the match as MatchClock.astro writes it without
|
|
10
|
+
// tiles ("Ends Sunday, October 18, 2026 at 11:59 PM", which is also what a
|
|
11
|
+
// visitor without script reads; "The match has ended" once it has passed in
|
|
12
|
+
// the visitor's browser, and the words before it go). On a phone
|
|
13
|
+
// the line wraps: the figures, the bar with its percent, the button full
|
|
14
|
+
// width. Without a goal there is no bar. Nothing is drawn without a raised
|
|
15
|
+
// figure.
|
|
16
|
+
import type { ComponentProps } from 'astro/types'
|
|
17
|
+
import Band from '../Band.astro'
|
|
18
|
+
import type Default from './index.astro'
|
|
19
|
+
import { links, rows } from '../../../lib/section'
|
|
20
|
+
import { formatCents, formatWhen, text } from '../../../lib/format'
|
|
21
|
+
import MatchClock from './MatchClock.astro'
|
|
22
|
+
|
|
23
|
+
type Props = ComponentProps<typeof Default>
|
|
24
|
+
|
|
25
|
+
const { section } = Astro.props
|
|
26
|
+
const [row] = rows(section)
|
|
27
|
+
const raised = typeof row?.raised_cents === 'number' ? row.raised_cents : null
|
|
28
|
+
const goal = typeof row?.goal_cents === 'number' && row.goal_cents > 0 ? row.goal_cents : null
|
|
29
|
+
const percent = raised !== null && goal !== null ? Math.min(100, Math.round((raised / goal) * 100)) : null
|
|
30
|
+
const multiplier = section.options?.matchMultiplier
|
|
31
|
+
const times = typeof multiplier === 'number' && Number.isInteger(multiplier) && multiplier >= 2 && multiplier <= 10 ? multiplier : null
|
|
32
|
+
const chip = text(section.copy.kicker) ?? (times !== null ? `${times}× match` : null)
|
|
33
|
+
const heading = text(section.copy.heading)
|
|
34
|
+
const [give] = links(section)
|
|
35
|
+
const until = text(section.options?.matchUntil)?.trim() ?? null
|
|
36
|
+
const ends = until !== null && !Number.isNaN(Date.parse(until)) ? formatWhen(until) : null
|
|
37
|
+
---
|
|
38
|
+
{raised !== null && (
|
|
39
|
+
<Band section={section} class="progress progress-compact">
|
|
40
|
+
<div class="compact">
|
|
41
|
+
{heading && <h2 class="compact-heading">{heading}</h2>}
|
|
42
|
+
<div class="compact-row">
|
|
43
|
+
<p class="compact-figures">
|
|
44
|
+
<strong class="compact-raised">{formatCents(raised)} raised</strong>
|
|
45
|
+
{goal !== null && <span class="compact-goal"> of a {formatCents(goal)} goal</span>}
|
|
46
|
+
</p>
|
|
47
|
+
{percent !== null && (
|
|
48
|
+
<div class="compact-bar">
|
|
49
|
+
<div class="meter compact-meter" role="img" aria-label={`${percent}% of the goal`}>
|
|
50
|
+
<span class="meter-fill" style={`width:${percent}%`}></span>
|
|
51
|
+
</div>
|
|
52
|
+
<span class="compact-percent" aria-hidden="true">{percent}%</span>
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
{give && <a class="button button-small compact-give" href={give.href} rel={give.rel}>{give.label}</a>}
|
|
56
|
+
</div>
|
|
57
|
+
{(chip || (ends && until)) && (
|
|
58
|
+
<div class="compact-match">
|
|
59
|
+
{chip && (
|
|
60
|
+
<span class="compact-chip" data-match-chip>
|
|
61
|
+
{chip}{ends && <span class="compact-dot" aria-hidden="true">·</span>}
|
|
62
|
+
</span>
|
|
63
|
+
)}
|
|
64
|
+
{ends && until && <MatchClock until={until} ends={ends} tiles={false} />}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
</Band>
|
|
69
|
+
)}
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.compact {
|
|
73
|
+
padding: clamp(1rem, 0.75rem + 1vw, 1.5rem) clamp(1.125rem, 0.75rem + 1.5vw, 1.75rem);
|
|
74
|
+
border: 1px solid var(--line);
|
|
75
|
+
border-radius: var(--radius-card);
|
|
76
|
+
background: color-mix(in srgb, var(--ink) 6%, transparent);
|
|
77
|
+
}
|
|
78
|
+
.compact-heading {
|
|
79
|
+
margin: 0 0 0.75rem;
|
|
80
|
+
font-size: var(--text-lg);
|
|
81
|
+
line-height: 1.25;
|
|
82
|
+
}
|
|
83
|
+
.compact-row {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-wrap: wrap;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 0.75rem 1.25rem;
|
|
88
|
+
}
|
|
89
|
+
.compact-figures {
|
|
90
|
+
margin: 0;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
}
|
|
93
|
+
.compact-raised {
|
|
94
|
+
font-weight: 800;
|
|
95
|
+
font-variant-numeric: lining-nums;
|
|
96
|
+
}
|
|
97
|
+
.compact-goal {
|
|
98
|
+
color: var(--muted);
|
|
99
|
+
}
|
|
100
|
+
.compact-bar {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex: 1 1 10rem;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 0.75rem;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
}
|
|
107
|
+
.compact-meter {
|
|
108
|
+
flex: 1;
|
|
109
|
+
height: 0.375rem;
|
|
110
|
+
}
|
|
111
|
+
.compact-percent {
|
|
112
|
+
color: var(--muted);
|
|
113
|
+
font-size: var(--text-sm);
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
font-variant-numeric: tabular-nums;
|
|
116
|
+
}
|
|
117
|
+
.compact-give {
|
|
118
|
+
margin-left: auto;
|
|
119
|
+
}
|
|
120
|
+
.compact-match {
|
|
121
|
+
margin-top: 0.625rem;
|
|
122
|
+
color: var(--muted);
|
|
123
|
+
font-size: var(--text-sm);
|
|
124
|
+
}
|
|
125
|
+
/* The clock's plain line runs on after the kicker as one sentence. */
|
|
126
|
+
.compact-match :global(.match-clock),
|
|
127
|
+
.compact-match :global(.match-clock p:not([hidden])) {
|
|
128
|
+
display: inline;
|
|
129
|
+
}
|
|
130
|
+
.compact-dot {
|
|
131
|
+
margin: 0 0.5em;
|
|
132
|
+
}
|
|
133
|
+
.compact-chip[hidden] {
|
|
134
|
+
display: none;
|
|
135
|
+
}
|
|
136
|
+
@media (max-width: 39.99rem) {
|
|
137
|
+
.compact-figures {
|
|
138
|
+
flex-basis: 100%;
|
|
139
|
+
white-space: normal;
|
|
140
|
+
}
|
|
141
|
+
.compact-bar {
|
|
142
|
+
flex-basis: 100%;
|
|
143
|
+
}
|
|
144
|
+
.compact-give {
|
|
145
|
+
flex-basis: 100%;
|
|
146
|
+
min-height: 2.75rem;
|
|
147
|
+
margin-left: 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Progress: how much has been raised toward the goal, as BackGold last
|
|
3
|
+
// counted it when the page was published.
|
|
4
|
+
import type { Section } from '@backgold/content'
|
|
5
|
+
import Band from '../Band.astro'
|
|
6
|
+
import { rows } from '../../../lib/section'
|
|
7
|
+
import { formatCents } from '../../../lib/format'
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
section: Section
|
|
11
|
+
variant?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { section } = Astro.props
|
|
15
|
+
const [row] = rows(section)
|
|
16
|
+
const raised = typeof row?.raised_cents === 'number' ? row.raised_cents : null
|
|
17
|
+
const goal = typeof row?.goal_cents === 'number' && row.goal_cents > 0 ? row.goal_cents : null
|
|
18
|
+
const percent = raised !== null && goal !== null ? Math.min(100, Math.round((raised / goal) * 100)) : null
|
|
19
|
+
---
|
|
20
|
+
{raised !== null && (
|
|
21
|
+
<Band section={section} class="progress">
|
|
22
|
+
<p class="progress-figures">
|
|
23
|
+
<strong class="progress-raised">{formatCents(raised)}</strong> raised
|
|
24
|
+
{goal !== null && <span> of a {formatCents(goal)} goal</span>}
|
|
25
|
+
</p>
|
|
26
|
+
{percent !== null && (
|
|
27
|
+
<div class="meter" role="img" aria-label={`${percent}% of the goal`}>
|
|
28
|
+
<span class="meter-fill" style={`width:${percent}%`}></span>
|
|
29
|
+
</div>
|
|
30
|
+
)}
|
|
31
|
+
</Band>
|
|
32
|
+
)}
|