@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,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
// QuickDonate, 'band' layout (board 16, C): a slim line for the end of an
|
|
3
|
+
// article or an episode, drawn as Cta · Strip draws its line: no card, a
|
|
4
|
+
// hairline rule above and below on the section's band, the heading in bold
|
|
5
|
+
// after a dot in the button colour, the body after it (the operator's
|
|
6
|
+
// "Enjoyed this? …"), and at the right up to three amounts (the first three
|
|
7
|
+
// the section lists) and the one small button. Each is a plain link to the
|
|
8
|
+
// organization's donate page in BackGold: an amount with its `?amount=`, the
|
|
9
|
+
// button with the link as the section sets it. There is no picker and no
|
|
10
|
+
// monthly switch: an amount is one tap to the donate page, which offers
|
|
11
|
+
// monthly itself. It does not stick and cannot be dismissed. On a phone the
|
|
12
|
+
// amounts and the button sit under the words. Nothing is drawn when the
|
|
13
|
+
// section has no donate link.
|
|
14
|
+
import type { ComponentProps } from 'astro/types'
|
|
15
|
+
import Band from '../Band.astro'
|
|
16
|
+
import Prose from '../../Prose.astro'
|
|
17
|
+
import type Default from './index.astro'
|
|
18
|
+
import { amountHref, dollars, quickDonate } from './donate'
|
|
19
|
+
import { prose, text } from '../../../lib/format'
|
|
20
|
+
|
|
21
|
+
type Props = ComponentProps<typeof Default>
|
|
22
|
+
|
|
23
|
+
const { section } = Astro.props
|
|
24
|
+
const qd = quickDonate(section)
|
|
25
|
+
const heading = text(section.copy.heading)
|
|
26
|
+
const body = prose(section.copy.body)
|
|
27
|
+
const shown = qd ? qd.amounts.slice(0, 3) : []
|
|
28
|
+
---
|
|
29
|
+
{qd && (
|
|
30
|
+
<Band section={section} class="quick-donate qd-band-band">
|
|
31
|
+
<div class="qd-band">
|
|
32
|
+
{(heading || body) && (
|
|
33
|
+
<div class="qd-band-words">
|
|
34
|
+
{heading && (
|
|
35
|
+
<h2 class="qd-band-heading">
|
|
36
|
+
<span class="qd-band-dot" aria-hidden="true"></span>{heading}
|
|
37
|
+
</h2>
|
|
38
|
+
)}
|
|
39
|
+
<Prose value={section.copy.body} class="qd-band-body" />
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
<div class="qd-band-choices">
|
|
43
|
+
<ul class="qd-band-amounts" role="list" aria-label="Give an amount">
|
|
44
|
+
{shown.map((amount) => (
|
|
45
|
+
<li>
|
|
46
|
+
<a class="qd-band-amount" href={amountHref(qd.donate.href, amount)} rel={qd.donate.rel}>{dollars(amount)}</a>
|
|
47
|
+
</li>
|
|
48
|
+
))}
|
|
49
|
+
</ul>
|
|
50
|
+
<a class="button button-small qd-band-give" href={qd.donate.href} rel={qd.donate.rel}>{qd.donate.label}</a>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</Band>
|
|
54
|
+
)}
|
|
55
|
+
|
|
56
|
+
<style>
|
|
57
|
+
:global(.bg-section.qd-band-band) {
|
|
58
|
+
--bg-section-padding: calc(var(--space) / 2) var(--gutter);
|
|
59
|
+
}
|
|
60
|
+
.qd-band {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 0.875rem 2rem;
|
|
65
|
+
padding: 1.125rem 0;
|
|
66
|
+
border-top: 1px solid var(--line);
|
|
67
|
+
border-bottom: 1px solid var(--line);
|
|
68
|
+
}
|
|
69
|
+
.qd-band-words {
|
|
70
|
+
flex: 1 1 18rem;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
}
|
|
73
|
+
.qd-band-words .qd-band-heading {
|
|
74
|
+
margin: 0;
|
|
75
|
+
font-family: var(--font);
|
|
76
|
+
font-size: var(--text);
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
letter-spacing: 0;
|
|
79
|
+
line-height: 1.35;
|
|
80
|
+
}
|
|
81
|
+
.qd-band-dot {
|
|
82
|
+
display: inline-block;
|
|
83
|
+
width: 0.5rem;
|
|
84
|
+
height: 0.5rem;
|
|
85
|
+
margin: 0 0.625rem 0.125rem 0;
|
|
86
|
+
border-radius: 50%;
|
|
87
|
+
background: var(--button);
|
|
88
|
+
vertical-align: middle;
|
|
89
|
+
}
|
|
90
|
+
.qd-band-words > :global(.qd-band-body) {
|
|
91
|
+
margin-top: 0.25rem;
|
|
92
|
+
max-width: none;
|
|
93
|
+
color: var(--muted);
|
|
94
|
+
font-size: var(--text-sm);
|
|
95
|
+
line-height: 1.45;
|
|
96
|
+
}
|
|
97
|
+
.qd-band-words > :global(.qd-band-body) :global(p) {
|
|
98
|
+
margin: 0;
|
|
99
|
+
}
|
|
100
|
+
.qd-band-choices {
|
|
101
|
+
display: flex;
|
|
102
|
+
flex: 1 1 auto;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 0.5rem;
|
|
105
|
+
}
|
|
106
|
+
.qd-band-amounts {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex: 1 1 auto;
|
|
109
|
+
gap: 0.5rem;
|
|
110
|
+
margin: 0;
|
|
111
|
+
padding: 0;
|
|
112
|
+
list-style: none;
|
|
113
|
+
}
|
|
114
|
+
.qd-band-amounts li {
|
|
115
|
+
flex: 1 1 0;
|
|
116
|
+
}
|
|
117
|
+
.qd-band-amount {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
min-height: 2.75rem;
|
|
122
|
+
padding: 0 0.75rem;
|
|
123
|
+
border: 2px solid var(--line-strong);
|
|
124
|
+
border-radius: var(--pill);
|
|
125
|
+
color: var(--ink);
|
|
126
|
+
font-family: var(--font-display);
|
|
127
|
+
font-size: 1.0625rem;
|
|
128
|
+
font-weight: 700;
|
|
129
|
+
font-variant-numeric: lining-nums tabular-nums;
|
|
130
|
+
text-decoration: none;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
}
|
|
133
|
+
.qd-band-amount:hover {
|
|
134
|
+
border-color: var(--ink);
|
|
135
|
+
}
|
|
136
|
+
.qd-band-give {
|
|
137
|
+
flex: 0 0 auto;
|
|
138
|
+
min-height: 2.75rem;
|
|
139
|
+
white-space: nowrap;
|
|
140
|
+
}
|
|
141
|
+
@media (min-width: 48rem) {
|
|
142
|
+
.qd-band {
|
|
143
|
+
flex-wrap: nowrap;
|
|
144
|
+
}
|
|
145
|
+
.qd-band-words .qd-band-heading {
|
|
146
|
+
font-size: 1.0625rem;
|
|
147
|
+
}
|
|
148
|
+
.qd-band-choices,
|
|
149
|
+
.qd-band-amounts {
|
|
150
|
+
flex: 0 0 auto;
|
|
151
|
+
}
|
|
152
|
+
.qd-band-amounts li {
|
|
153
|
+
flex: 0 0 auto;
|
|
154
|
+
}
|
|
155
|
+
.qd-band-amount {
|
|
156
|
+
min-width: 4.5rem;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
160
|
+
.qd-band-amount {
|
|
161
|
+
transition: border-color 0.15s ease;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
// QuickDonate, 'bar' layout (board 01, C): a slim bar pinned to the bottom of
|
|
3
|
+
// the screen (`position: sticky` on its band, clear of a phone's home
|
|
4
|
+
// indicator) until the reader scrolls to its own place on the page, where it
|
|
5
|
+
// settles; placed last, it stays in view the whole way down. The heading in
|
|
6
|
+
// bold and the body (two lines at most) at the left; at the right up to three
|
|
7
|
+
// amounts (the one that starts selected and its neighbours), the one button
|
|
8
|
+
// and Dismiss, which hides the bar for the rest of the visit. On a phone the
|
|
9
|
+
// words sit over a row of the amounts and the button. It wears the band it is
|
|
10
|
+
// given; the contrast band sets it apart from the page. The amounts and the
|
|
11
|
+
// button behave as the grid layout's do (Picker.astro); the bar has no
|
|
12
|
+
// monthly switch. Nothing is drawn when the section has no donate link.
|
|
13
|
+
import type { ComponentProps } from 'astro/types'
|
|
14
|
+
import Band from '../Band.astro'
|
|
15
|
+
import Prose from '../../Prose.astro'
|
|
16
|
+
import Picker from './Picker.astro'
|
|
17
|
+
import type Default from './index.astro'
|
|
18
|
+
import { amountHref, dollars, giveLabel, quickDonate } from './donate'
|
|
19
|
+
import { text } from '../../../lib/format'
|
|
20
|
+
|
|
21
|
+
type Props = ComponentProps<typeof Default>
|
|
22
|
+
|
|
23
|
+
const { section } = Astro.props
|
|
24
|
+
const qd = quickDonate(section)
|
|
25
|
+
const heading = text(section.copy.heading)
|
|
26
|
+
// Three amounts around the one that starts selected (the first three when none does).
|
|
27
|
+
const at = qd?.selected != null ? qd.amounts.indexOf(qd.selected) : 0
|
|
28
|
+
const start = qd ? Math.max(0, Math.min(at - 1, qd.amounts.length - 3)) : 0
|
|
29
|
+
const shown = qd ? qd.amounts.slice(start, start + 3) : []
|
|
30
|
+
---
|
|
31
|
+
{qd && (
|
|
32
|
+
<Band section={section} class="quick-donate qd-bar-band">
|
|
33
|
+
<div class="qd-bar" data-quick-donate data-href={qd.donate.href} data-label={qd.donate.label} data-dismiss-key={section.id}>
|
|
34
|
+
<div class="qd-bar-words">
|
|
35
|
+
{heading && <h2 class="qd-bar-heading">{heading}</h2>}
|
|
36
|
+
<Prose value={section.copy.body} class="qd-bar-body" />
|
|
37
|
+
</div>
|
|
38
|
+
<div class="qd-bar-choices">
|
|
39
|
+
<ul class="qd-bar-amounts" role="list" aria-label="Choose an amount">
|
|
40
|
+
{shown.map((amount) => (
|
|
41
|
+
<li>
|
|
42
|
+
<a class="qd-bar-amount" href={amountHref(qd.donate.href, amount)} rel={qd.donate.rel} data-amount={amount} data-selected={amount === qd.selected ? '' : undefined}>
|
|
43
|
+
{dollars(amount)}
|
|
44
|
+
</a>
|
|
45
|
+
</li>
|
|
46
|
+
))}
|
|
47
|
+
</ul>
|
|
48
|
+
<a class="button qd-bar-give" href={amountHref(qd.donate.href, qd.selected)} rel={qd.donate.rel} data-give>{giveLabel(qd)}</a>
|
|
49
|
+
</div>
|
|
50
|
+
<button type="button" class="qd-dismiss" aria-label="Dismiss" data-dismiss hidden>
|
|
51
|
+
<span aria-hidden="true">×</span>
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
<Picker />
|
|
55
|
+
</Band>
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
:global(.bg-section.qd-bar-band) {
|
|
60
|
+
position: sticky;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
z-index: 10;
|
|
63
|
+
--bg-section-padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom, 0px));
|
|
64
|
+
border-top: 1px solid var(--line);
|
|
65
|
+
}
|
|
66
|
+
:global(.bg-section.qd-bar-band.bg-bleed-contained) {
|
|
67
|
+
margin-bottom: 0;
|
|
68
|
+
border-bottom-left-radius: 0;
|
|
69
|
+
border-bottom-right-radius: 0;
|
|
70
|
+
}
|
|
71
|
+
.qd-bar {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
74
|
+
grid-template-areas:
|
|
75
|
+
'words dismiss'
|
|
76
|
+
'choices choices';
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 0.625rem 0.75rem;
|
|
79
|
+
}
|
|
80
|
+
.qd-bar-words {
|
|
81
|
+
grid-area: words;
|
|
82
|
+
min-width: 0;
|
|
83
|
+
font-size: var(--text-sm);
|
|
84
|
+
line-height: 1.4;
|
|
85
|
+
}
|
|
86
|
+
.qd-bar-heading {
|
|
87
|
+
margin: 0;
|
|
88
|
+
font-family: var(--font);
|
|
89
|
+
font-size: var(--text);
|
|
90
|
+
font-weight: 700;
|
|
91
|
+
letter-spacing: 0;
|
|
92
|
+
line-height: 1.3;
|
|
93
|
+
}
|
|
94
|
+
/* At most two lines, so a long body never lifts the bar over the page. */
|
|
95
|
+
.qd-bar-words > :global(.qd-bar-body) {
|
|
96
|
+
display: -webkit-box;
|
|
97
|
+
-webkit-box-orient: vertical;
|
|
98
|
+
-webkit-line-clamp: 2;
|
|
99
|
+
line-clamp: 2;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
max-width: none;
|
|
102
|
+
color: var(--muted);
|
|
103
|
+
line-height: 1.4;
|
|
104
|
+
}
|
|
105
|
+
.qd-bar-words > :global(.qd-bar-body) :global(p) {
|
|
106
|
+
margin: 0;
|
|
107
|
+
}
|
|
108
|
+
.qd-bar-choices {
|
|
109
|
+
grid-area: choices;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: 0.5rem;
|
|
113
|
+
}
|
|
114
|
+
.qd-bar-amounts {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex: 1 1 auto;
|
|
117
|
+
gap: 0.5rem;
|
|
118
|
+
margin: 0;
|
|
119
|
+
padding: 0;
|
|
120
|
+
list-style: none;
|
|
121
|
+
}
|
|
122
|
+
.qd-bar-amounts li {
|
|
123
|
+
flex: 1 1 0;
|
|
124
|
+
}
|
|
125
|
+
.qd-bar-amount {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
min-height: 2.75rem;
|
|
130
|
+
padding: 0 0.75rem;
|
|
131
|
+
border: 2px solid var(--line-strong);
|
|
132
|
+
border-radius: var(--pill);
|
|
133
|
+
color: var(--ink);
|
|
134
|
+
font-family: var(--font-display);
|
|
135
|
+
font-size: 1.0625rem;
|
|
136
|
+
font-weight: 700;
|
|
137
|
+
font-variant-numeric: lining-nums tabular-nums;
|
|
138
|
+
text-decoration: none;
|
|
139
|
+
white-space: nowrap;
|
|
140
|
+
}
|
|
141
|
+
.qd-bar-amount:hover {
|
|
142
|
+
border-color: var(--ink);
|
|
143
|
+
}
|
|
144
|
+
.qd-bar-amount[data-selected] {
|
|
145
|
+
background: var(--button-2);
|
|
146
|
+
border-color: var(--button-2);
|
|
147
|
+
color: var(--button-2-ink);
|
|
148
|
+
}
|
|
149
|
+
.qd-bar-give {
|
|
150
|
+
flex: 0 0 auto;
|
|
151
|
+
min-height: 2.75rem;
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
}
|
|
154
|
+
.qd-dismiss {
|
|
155
|
+
grid-area: dismiss;
|
|
156
|
+
display: grid;
|
|
157
|
+
place-items: center;
|
|
158
|
+
width: 2.75rem;
|
|
159
|
+
height: 2.75rem;
|
|
160
|
+
margin: -0.25rem -0.5rem 0 0;
|
|
161
|
+
align-self: start;
|
|
162
|
+
border: 0;
|
|
163
|
+
border-radius: 50%;
|
|
164
|
+
background: none;
|
|
165
|
+
color: var(--muted);
|
|
166
|
+
font: inherit;
|
|
167
|
+
font-size: 1.5rem;
|
|
168
|
+
line-height: 1;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
.qd-dismiss:hover {
|
|
172
|
+
color: var(--ink);
|
|
173
|
+
}
|
|
174
|
+
.qd-dismiss[hidden] {
|
|
175
|
+
display: none;
|
|
176
|
+
}
|
|
177
|
+
@media (min-width: 48rem) {
|
|
178
|
+
.qd-bar {
|
|
179
|
+
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
180
|
+
grid-template-areas: 'words choices dismiss';
|
|
181
|
+
gap: 1.5rem;
|
|
182
|
+
}
|
|
183
|
+
.qd-bar-words {
|
|
184
|
+
font-size: var(--text);
|
|
185
|
+
}
|
|
186
|
+
.qd-bar-heading {
|
|
187
|
+
font-size: 1.0625rem;
|
|
188
|
+
}
|
|
189
|
+
.qd-bar-amounts li {
|
|
190
|
+
flex: 0 0 auto;
|
|
191
|
+
}
|
|
192
|
+
.qd-bar-amount {
|
|
193
|
+
min-width: 4.5rem;
|
|
194
|
+
}
|
|
195
|
+
.qd-dismiss {
|
|
196
|
+
margin: 0 -0.5rem 0 -0.75rem;
|
|
197
|
+
align-self: center;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
201
|
+
.qd-bar-amount {
|
|
202
|
+
transition:
|
|
203
|
+
background-color 0.15s ease,
|
|
204
|
+
border-color 0.15s ease,
|
|
205
|
+
color 0.15s ease;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// A QuickDonate's choices as its layouts draw them: the donate link (the
|
|
2
|
+
// section's one link, whose label is the button's), the amounts, the one that
|
|
3
|
+
// starts selected, the monthly switch when the section offers it, and the
|
|
4
|
+
// address each choice hands to BackGold's donate page (and, for the jar
|
|
5
|
+
// layout, its unit and the quantities of it). The donate page reads
|
|
6
|
+
// `?amount=` in whole dollars from 1 to 99,999 and `?frequency=monthly`, so an
|
|
7
|
+
// amount outside that is left out here rather than sent and ignored there.
|
|
8
|
+
// Null when the section has no donate link: there is nothing to give through.
|
|
9
|
+
|
|
10
|
+
import type { Section } from '@backgold/content'
|
|
11
|
+
import { links, rows, type Link } from '../../../lib/section'
|
|
12
|
+
import { formatCents, text } from '../../../lib/format'
|
|
13
|
+
|
|
14
|
+
/** The amounts when the section names none the donate page would take. */
|
|
15
|
+
const DEFAULT_AMOUNTS = [10, 25, 50, 100, 250]
|
|
16
|
+
/** Three rows of three, with Other. */
|
|
17
|
+
const MAX_AMOUNTS = 8
|
|
18
|
+
|
|
19
|
+
export interface QuickDonate {
|
|
20
|
+
donate: Link
|
|
21
|
+
/** Whole dollars, in the order the section lists them. */
|
|
22
|
+
amounts: number[]
|
|
23
|
+
/** The amount that starts selected, when the section's default is one of them. */
|
|
24
|
+
selected: number | null
|
|
25
|
+
/** The monthly switch's label, or null when the section does not offer it. */
|
|
26
|
+
monthly: string | null
|
|
27
|
+
note: string | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function wholeDollars(value: unknown): number | null {
|
|
31
|
+
const raw = typeof value === 'number' ? String(value) : typeof value === 'string' ? value.trim().replace(/^\$/, '') : ''
|
|
32
|
+
if (!/^\d{1,5}$/.test(raw)) return null
|
|
33
|
+
const dollars = Number(raw)
|
|
34
|
+
return dollars >= 1 && dollars <= 99999 ? dollars : null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function amountsOf(value: unknown): number[] {
|
|
38
|
+
const parts = typeof value === 'string' ? value.split(',') : []
|
|
39
|
+
const amounts = [...new Set(parts.map(wholeDollars).filter((n): n is number => n !== null))]
|
|
40
|
+
return amounts.length > 0 ? amounts.slice(0, MAX_AMOUNTS) : DEFAULT_AMOUNTS
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The section's default amount in whole dollars, when the donate page would take it. */
|
|
44
|
+
export function presetOf(section: Section): number | null {
|
|
45
|
+
return wholeDollars(section.options?.defaultAmount)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function quickDonate(section: Section): QuickDonate | null {
|
|
49
|
+
const [donate] = links(section)
|
|
50
|
+
if (!donate) return null
|
|
51
|
+
const amounts = amountsOf(section.options?.amounts)
|
|
52
|
+
const preset = presetOf(section)
|
|
53
|
+
return {
|
|
54
|
+
donate,
|
|
55
|
+
amounts,
|
|
56
|
+
selected: preset !== null && amounts.includes(preset) ? preset : null,
|
|
57
|
+
monthly: section.options?.monthly === true ? (text(section.copy.monthlyLabel) ?? 'Make it monthly') : null,
|
|
58
|
+
note: text(section.copy.note),
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** "$25", "$1,000". */
|
|
63
|
+
export function dollars(amount: number): string {
|
|
64
|
+
return formatCents(amount * 100) ?? `$${amount}`
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The donate address with `?amount=` set, or with none for Other (any amount already on the link is replaced). */
|
|
68
|
+
export function amountHref(href: string, amount: number | null): string {
|
|
69
|
+
const url = new URL(href, 'https://site.invalid')
|
|
70
|
+
url.searchParams.delete('amount')
|
|
71
|
+
if (amount !== null) url.searchParams.set('amount', String(amount))
|
|
72
|
+
return url.origin === 'https://site.invalid' ? `${url.pathname}${url.search}${url.hash}` : url.href
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The button's words: "Donate $25" with an amount selected, else the link's own label. */
|
|
76
|
+
export function giveLabel(qd: QuickDonate): string {
|
|
77
|
+
return qd.selected === null ? qd.donate.label : `${qd.donate.label} ${dollars(qd.selected)}`
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The jar layout's quantities of its unit. */
|
|
81
|
+
const JAR_COUNTS = [1, 3, 5]
|
|
82
|
+
|
|
83
|
+
export interface Jar {
|
|
84
|
+
/** Whole dollars: one of what the jar asks for. */
|
|
85
|
+
unit: number
|
|
86
|
+
/** Each quantity with its total; a quantity whose total the donate page would not take is left out. */
|
|
87
|
+
choices: { count: number; amount: number }[]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The jar layout's choices: its unit is the section's default amount when
|
|
92
|
+
* the donate page would take it, else the first of its amounts (the rest are
|
|
93
|
+
* not drawn), offered as 1, 3 and 5 of it.
|
|
94
|
+
*/
|
|
95
|
+
export function jarOf(section: Section, qd: QuickDonate): Jar {
|
|
96
|
+
const unit = wholeDollars(section.options?.defaultAmount) ?? qd.amounts[0]
|
|
97
|
+
const choices = JAR_COUNTS.map((count) => ({ count, amount: unit * count })).filter((c) => wholeDollars(c.amount) !== null)
|
|
98
|
+
return { unit, choices }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The contract holds the ladder to eight rows. */
|
|
102
|
+
const MAX_RUNGS = 8
|
|
103
|
+
|
|
104
|
+
/** One rung of the ladder layout: what a gift of `amount` does. */
|
|
105
|
+
export interface Rung {
|
|
106
|
+
/** Whole dollars, as the donate page takes them. */
|
|
107
|
+
amount: number
|
|
108
|
+
impact: string
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The ladder layout's rungs: the section's `ladder` rows with an amount the
|
|
113
|
+
* donate page would take and words for what it does, in the order the
|
|
114
|
+
* section lists them; a second row for the same amount is left out.
|
|
115
|
+
*/
|
|
116
|
+
export function ladderOf(section: Section): Rung[] {
|
|
117
|
+
const rungs: Rung[] = []
|
|
118
|
+
for (const row of rows(section)) {
|
|
119
|
+
const amount = wholeDollars(row.amount)
|
|
120
|
+
const impact = text(row.impact)
|
|
121
|
+
if (amount === null || !impact || rungs.some((r) => r.amount === amount)) continue
|
|
122
|
+
rungs.push({ amount, impact })
|
|
123
|
+
if (rungs.length === MAX_RUNGS) break
|
|
124
|
+
}
|
|
125
|
+
return rungs
|
|
126
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
// QuickDonate, 'hero' layout (board 01, B): the photo at the left with the
|
|
3
|
+
// kicker chip and the heading over its lower edge on a fixed scrim, in the
|
|
4
|
+
// photo band's inks as Hero · Full photo sets them, and the body under the
|
|
5
|
+
// photo; the donate card at the right, as the grid layout draws it. Without a
|
|
6
|
+
// photo the kicker, heading and body sit on a panel of the band's surface.
|
|
7
|
+
// On a phone the card follows. The heading is an <h2>: this is never the
|
|
8
|
+
// page's opening Hero. It shows no raised figures or donor counts; a Progress
|
|
9
|
+
// section beside it carries those. Nothing is drawn when the section has no
|
|
10
|
+
// donate link.
|
|
11
|
+
import type { ComponentProps } from 'astro/types'
|
|
12
|
+
import Band from '../Band.astro'
|
|
13
|
+
import Prose from '../../Prose.astro'
|
|
14
|
+
import DonateCard from './DonateCard.astro'
|
|
15
|
+
import type Default from './index.astro'
|
|
16
|
+
import { quickDonate } from './donate'
|
|
17
|
+
import { media } from '../../../lib/section'
|
|
18
|
+
import { text } from '../../../lib/format'
|
|
19
|
+
|
|
20
|
+
type Props = ComponentProps<typeof Default>
|
|
21
|
+
|
|
22
|
+
const { section } = Astro.props
|
|
23
|
+
const qd = quickDonate(section)
|
|
24
|
+
const kicker = text(section.copy.kicker)
|
|
25
|
+
const heading = text(section.copy.heading)
|
|
26
|
+
const picture = media(section, 'imageUrl')
|
|
27
|
+
---
|
|
28
|
+
{qd && (
|
|
29
|
+
<Band section={section} class="quick-donate qd-hero">
|
|
30
|
+
<div class="qd-hero-grid">
|
|
31
|
+
{picture ? (
|
|
32
|
+
<div class="qd-story">
|
|
33
|
+
<div class="qd-photo">
|
|
34
|
+
<img class="qd-photo-image" src={picture.url} alt={picture.alt} loading="lazy" decoding="async" />
|
|
35
|
+
{(kicker || heading) && (
|
|
36
|
+
<>
|
|
37
|
+
<div class="qd-scrim" aria-hidden="true"></div>
|
|
38
|
+
<div class="qd-photo-words on-photo">
|
|
39
|
+
{kicker && <p class="chip qd-kicker">{kicker}</p>}
|
|
40
|
+
{heading && <h2 class="qd-hero-heading">{heading}</h2>}
|
|
41
|
+
</div>
|
|
42
|
+
</>
|
|
43
|
+
)}
|
|
44
|
+
</div>
|
|
45
|
+
<Prose value={section.copy.body} class="lede qd-hero-body" />
|
|
46
|
+
</div>
|
|
47
|
+
) : (
|
|
48
|
+
<div class="qd-story qd-panel">
|
|
49
|
+
{kicker && <p class="chip qd-kicker">{kicker}</p>}
|
|
50
|
+
{heading && <h2 class="qd-hero-heading">{heading}</h2>}
|
|
51
|
+
<Prose value={section.copy.body} class="lede qd-hero-body" />
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
<DonateCard qd={qd} />
|
|
55
|
+
</div>
|
|
56
|
+
</Band>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
<style>
|
|
60
|
+
.qd-hero-grid {
|
|
61
|
+
display: grid;
|
|
62
|
+
gap: 1.75rem;
|
|
63
|
+
}
|
|
64
|
+
.qd-story {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
min-width: 0;
|
|
68
|
+
}
|
|
69
|
+
.qd-photo {
|
|
70
|
+
position: relative;
|
|
71
|
+
isolation: isolate;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
min-height: 20rem;
|
|
76
|
+
padding: clamp(1.25rem, 0.8rem + 1.6vw, 2rem);
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
border-radius: var(--radius-card);
|
|
79
|
+
}
|
|
80
|
+
.qd-photo-image {
|
|
81
|
+
position: absolute;
|
|
82
|
+
inset: 0;
|
|
83
|
+
z-index: -2;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
max-width: none;
|
|
87
|
+
object-fit: cover;
|
|
88
|
+
}
|
|
89
|
+
/* Hero · Full photo's scrim: clear at the top, deep under the words, so they read on any photo. */
|
|
90
|
+
.qd-scrim {
|
|
91
|
+
position: absolute;
|
|
92
|
+
inset: 0;
|
|
93
|
+
z-index: -1;
|
|
94
|
+
background: linear-gradient(
|
|
95
|
+
180deg,
|
|
96
|
+
color-mix(in srgb, var(--band-photo) 0%, transparent) 25%,
|
|
97
|
+
color-mix(in srgb, var(--band-photo) 55%, transparent) 55%,
|
|
98
|
+
color-mix(in srgb, var(--band-photo) 90%, transparent) 100%
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
.qd-kicker {
|
|
102
|
+
align-self: flex-start;
|
|
103
|
+
margin: 0 0 0.875rem;
|
|
104
|
+
}
|
|
105
|
+
.qd-hero-heading {
|
|
106
|
+
margin: 0;
|
|
107
|
+
max-width: 14em;
|
|
108
|
+
font-size: clamp(2.25rem, 1.4rem + 2.8vw, 3.5rem);
|
|
109
|
+
line-height: 1;
|
|
110
|
+
letter-spacing: -0.025em;
|
|
111
|
+
}
|
|
112
|
+
.qd-story > :global(.qd-hero-body) {
|
|
113
|
+
margin: 1.25rem 0 0;
|
|
114
|
+
}
|
|
115
|
+
.qd-story > :global(.qd-hero-body) > :last-child {
|
|
116
|
+
margin-bottom: 0;
|
|
117
|
+
}
|
|
118
|
+
.qd-panel {
|
|
119
|
+
justify-content: center;
|
|
120
|
+
padding: clamp(1.5rem, 1rem + 2vw, 2.75rem);
|
|
121
|
+
background: var(--surface);
|
|
122
|
+
border: 1px solid var(--line);
|
|
123
|
+
border-radius: var(--radius-card);
|
|
124
|
+
}
|
|
125
|
+
@media (min-width: 48rem) {
|
|
126
|
+
.qd-photo {
|
|
127
|
+
min-height: 26rem;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
@media (min-width: 56rem) {
|
|
131
|
+
.qd-hero-grid {
|
|
132
|
+
grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
|
|
133
|
+
gap: clamp(2rem, 3.5vw, 3rem);
|
|
134
|
+
align-items: stretch;
|
|
135
|
+
}
|
|
136
|
+
.qd-photo {
|
|
137
|
+
flex: 1 0 auto;
|
|
138
|
+
}
|
|
139
|
+
.qd-hero-grid > :global(.qd-card) {
|
|
140
|
+
align-self: center;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</style>
|