@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,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Services, 'packages' layout, the default (board S04, A, "Three packages"):
|
|
3
|
+
// the section head and the body, then a card per service in the operator's
|
|
4
|
+
// order, three across (two on a tablet, one under another on a phone): the
|
|
5
|
+
// service's name small in capitals, its price large in the display face as
|
|
6
|
+
// the operator typed it ("$4,500/mo", "15% of spend"), the term muted under
|
|
7
|
+
// it, the summary, what it includes as a checked list, and its one button.
|
|
8
|
+
// A section with one service draws one card, centred.
|
|
9
|
+
//
|
|
10
|
+
// The featured service's card is filled in the band's second button colour
|
|
11
|
+
// and carries the solid button; the copy's featured label ("Where most
|
|
12
|
+
// campaigns start") sits on it as a chip only when the operator wrote one, so
|
|
13
|
+
// the fill alone claims nothing. The other cards' buttons are outlined; with
|
|
14
|
+
// no featured service every button is, and a single card's is solid. The
|
|
15
|
+
// note sits small under the cards. Nothing is drawn with neither a heading
|
|
16
|
+
// nor a service.
|
|
17
|
+
import type { Section } from '@backgold/content'
|
|
18
|
+
import Band from '../Band.astro'
|
|
19
|
+
import SectionHead from '../SectionHead.astro'
|
|
20
|
+
import Prose from '../../Prose.astro'
|
|
21
|
+
import Button from './Button.astro'
|
|
22
|
+
import Includes from './Includes.astro'
|
|
23
|
+
import { servicesOf } from './services'
|
|
24
|
+
import { text } from '../../../lib/format'
|
|
25
|
+
|
|
26
|
+
interface Props {
|
|
27
|
+
section: Section
|
|
28
|
+
variant?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { section } = Astro.props
|
|
32
|
+
const kicker = text(section.copy.kicker)
|
|
33
|
+
const heading = text(section.copy.heading)
|
|
34
|
+
const s = servicesOf(section)
|
|
35
|
+
const many = s.items.length > 1
|
|
36
|
+
---
|
|
37
|
+
{(heading || s.items.length > 0) && (
|
|
38
|
+
<Band section={section} class="services services-packages">
|
|
39
|
+
<SectionHead kicker={kicker} heading={heading} more={[]} />
|
|
40
|
+
<Prose value={section.copy.body} class="lede" />
|
|
41
|
+
{s.items.length > 0 && (
|
|
42
|
+
<ul class="sv-packages" role="list" data-count={Math.min(s.items.length, 3)}>
|
|
43
|
+
{s.items.map((service) => (
|
|
44
|
+
<li class:list={['sv-package', service.featured && 'sv-package-featured']}>
|
|
45
|
+
<div class="sv-package-body">
|
|
46
|
+
<div class="sv-package-head">
|
|
47
|
+
<h3 class="sv-package-name">{service.name}</h3>
|
|
48
|
+
{service.featured && s.featuredLabel && <span class="chip sv-featured">{s.featuredLabel}</span>}
|
|
49
|
+
</div>
|
|
50
|
+
{service.price && <p class="sv-package-price">{service.price}</p>}
|
|
51
|
+
{service.term && <p class="sv-package-term">{service.term}</p>}
|
|
52
|
+
{service.summary && <p class="sv-package-summary">{service.summary}</p>}
|
|
53
|
+
<Includes items={service.includes} class="sv-package-includes" />
|
|
54
|
+
</div>
|
|
55
|
+
<Button service={service} solid={service.featured || !many} many={many} class="sv-package-button" />
|
|
56
|
+
</li>
|
|
57
|
+
))}
|
|
58
|
+
</ul>
|
|
59
|
+
)}
|
|
60
|
+
{s.note && <p class="fine sv-packages-note">{s.note}</p>}
|
|
61
|
+
</Band>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.sv-packages {
|
|
66
|
+
display: grid;
|
|
67
|
+
gap: clamp(1rem, 2vw, 1.5rem);
|
|
68
|
+
margin: 0;
|
|
69
|
+
padding: 0;
|
|
70
|
+
list-style: none;
|
|
71
|
+
}
|
|
72
|
+
:global(.lede) + .sv-packages {
|
|
73
|
+
margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
|
|
74
|
+
}
|
|
75
|
+
.sv-package {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
padding: clamp(1.375rem, 1rem + 1vw, 1.875rem);
|
|
80
|
+
border: 1px solid var(--line);
|
|
81
|
+
border-radius: var(--radius-card);
|
|
82
|
+
background: var(--surface);
|
|
83
|
+
color: var(--ink);
|
|
84
|
+
}
|
|
85
|
+
:global(.bg-band-contrast) .sv-package {
|
|
86
|
+
background: color-mix(in srgb, var(--ink) 7%, transparent);
|
|
87
|
+
}
|
|
88
|
+
.sv-package-featured,
|
|
89
|
+
:global(.bg-band-contrast) .sv-package-featured {
|
|
90
|
+
border-color: var(--button-2);
|
|
91
|
+
background: var(--button-2);
|
|
92
|
+
color: var(--button-2-ink);
|
|
93
|
+
box-shadow: var(--shadow);
|
|
94
|
+
--sv-check: var(--button-2-ink);
|
|
95
|
+
}
|
|
96
|
+
.sv-package-head {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-wrap: wrap;
|
|
99
|
+
align-items: center;
|
|
100
|
+
gap: 0.5rem 0.75rem;
|
|
101
|
+
min-height: 1.75rem;
|
|
102
|
+
}
|
|
103
|
+
.sv-package-name {
|
|
104
|
+
margin: 0;
|
|
105
|
+
color: var(--muted);
|
|
106
|
+
font-family: var(--font);
|
|
107
|
+
font-size: var(--text-xs);
|
|
108
|
+
font-weight: 700;
|
|
109
|
+
letter-spacing: 0.16em;
|
|
110
|
+
line-height: 1.4;
|
|
111
|
+
text-transform: uppercase;
|
|
112
|
+
}
|
|
113
|
+
.sv-package-featured .sv-package-name {
|
|
114
|
+
color: color-mix(in srgb, var(--button-2-ink) 78%, transparent);
|
|
115
|
+
}
|
|
116
|
+
.sv-package-featured .sv-featured {
|
|
117
|
+
background: color-mix(in srgb, var(--button-2-ink) 16%, transparent);
|
|
118
|
+
color: var(--button-2-ink);
|
|
119
|
+
}
|
|
120
|
+
.sv-package-price {
|
|
121
|
+
margin: 0.875rem 0 0;
|
|
122
|
+
font-family: var(--font-display);
|
|
123
|
+
font-size: clamp(2rem, 1.6rem + 1.2vw, 2.75rem);
|
|
124
|
+
font-variant-numeric: lining-nums;
|
|
125
|
+
font-weight: 800;
|
|
126
|
+
letter-spacing: -0.02em;
|
|
127
|
+
line-height: 1.05;
|
|
128
|
+
}
|
|
129
|
+
.sv-package-term {
|
|
130
|
+
margin: 0.5rem 0 0;
|
|
131
|
+
color: var(--muted);
|
|
132
|
+
font-size: 0.9375rem;
|
|
133
|
+
}
|
|
134
|
+
.sv-package-summary {
|
|
135
|
+
margin: 0.875rem 0 0;
|
|
136
|
+
font-size: 0.9375rem;
|
|
137
|
+
line-height: 1.5;
|
|
138
|
+
}
|
|
139
|
+
.sv-package-featured .sv-package-term {
|
|
140
|
+
color: color-mix(in srgb, var(--button-2-ink) 82%, transparent);
|
|
141
|
+
}
|
|
142
|
+
.sv-package :global(.sv-package-includes) {
|
|
143
|
+
margin: 1.375rem 0 0;
|
|
144
|
+
padding-top: 1.25rem;
|
|
145
|
+
border-top: 1px solid var(--line);
|
|
146
|
+
font-size: 0.9375rem;
|
|
147
|
+
}
|
|
148
|
+
.sv-package-featured :global(.sv-package-includes) {
|
|
149
|
+
border-top-color: color-mix(in srgb, var(--button-2-ink) 22%, transparent);
|
|
150
|
+
}
|
|
151
|
+
.sv-package-body {
|
|
152
|
+
flex: 1 0 auto;
|
|
153
|
+
}
|
|
154
|
+
.sv-package :global(.sv-package-button) {
|
|
155
|
+
display: flex;
|
|
156
|
+
width: 100%;
|
|
157
|
+
margin-top: 1.5rem;
|
|
158
|
+
}
|
|
159
|
+
.sv-package-featured :focus-visible {
|
|
160
|
+
outline-color: var(--button-2-ink);
|
|
161
|
+
}
|
|
162
|
+
.sv-packages-note {
|
|
163
|
+
margin: 1.25rem 0 0;
|
|
164
|
+
text-align: center;
|
|
165
|
+
}
|
|
166
|
+
[data-count='1'] {
|
|
167
|
+
max-width: 26rem;
|
|
168
|
+
margin-inline: auto;
|
|
169
|
+
}
|
|
170
|
+
@media (min-width: 40rem) {
|
|
171
|
+
.sv-packages {
|
|
172
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
173
|
+
}
|
|
174
|
+
[data-count='1'] {
|
|
175
|
+
grid-template-columns: minmax(0, 1fr);
|
|
176
|
+
}
|
|
177
|
+
[data-count='2'] {
|
|
178
|
+
max-width: 48rem;
|
|
179
|
+
margin-inline: auto;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
@media (min-width: 56rem) {
|
|
183
|
+
.sv-packages[data-count='3'] {
|
|
184
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Services, 'list' layout (board S04, B, "Service list + starting at"): the
|
|
3
|
+
// section head and the body, then a row per service in the operator's order,
|
|
4
|
+
// each on the band's surface: the name and the summary at the left; at the
|
|
5
|
+
// right the copy's starting label small in capitals ("Starting at") over the
|
|
6
|
+
// price as the operator typed it, the term muted under it; then the row's
|
|
7
|
+
// button. The prices and the buttons line up down the list. The template
|
|
8
|
+
// draws no icons, so a row's `icon` is not drawn.
|
|
9
|
+
//
|
|
10
|
+
// Every button is outlined but the featured service's, which is solid, so
|
|
11
|
+
// the section has one solid button at most; the copy's featured label sits
|
|
12
|
+
// beside that service's name as a chip only when the operator wrote one. On a
|
|
13
|
+
// phone a row's words come first, the price and the button under them. The
|
|
14
|
+
// note sits small under the list. Nothing is drawn with neither a heading
|
|
15
|
+
// nor a service.
|
|
16
|
+
import type { ComponentProps } from 'astro/types'
|
|
17
|
+
import type Default from './index.astro'
|
|
18
|
+
import Band from '../Band.astro'
|
|
19
|
+
import SectionHead from '../SectionHead.astro'
|
|
20
|
+
import Prose from '../../Prose.astro'
|
|
21
|
+
import Button from './Button.astro'
|
|
22
|
+
import { servicesOf } from './services'
|
|
23
|
+
import { text } from '../../../lib/format'
|
|
24
|
+
|
|
25
|
+
type Props = ComponentProps<typeof Default>
|
|
26
|
+
|
|
27
|
+
const { section } = Astro.props
|
|
28
|
+
const kicker = text(section.copy.kicker)
|
|
29
|
+
const heading = text(section.copy.heading)
|
|
30
|
+
const s = servicesOf(section)
|
|
31
|
+
const many = s.items.length > 1
|
|
32
|
+
---
|
|
33
|
+
{(heading || s.items.length > 0) && (
|
|
34
|
+
<Band section={section} class="services services-list">
|
|
35
|
+
<SectionHead kicker={kicker} heading={heading} more={[]} />
|
|
36
|
+
<Prose value={section.copy.body} class="lede" />
|
|
37
|
+
{s.items.length > 0 && (
|
|
38
|
+
<ul class="sv-rows" role="list">
|
|
39
|
+
{s.items.map((service) => (
|
|
40
|
+
<li class:list={['sv-row', service.featured && 'sv-row-featured']}>
|
|
41
|
+
<div class="sv-row-words">
|
|
42
|
+
<div class="sv-row-head">
|
|
43
|
+
<h3 class="sv-row-name">{service.name}</h3>
|
|
44
|
+
{service.featured && s.featuredLabel && <span class="chip">{s.featuredLabel}</span>}
|
|
45
|
+
</div>
|
|
46
|
+
{service.summary && <p class="sv-row-summary">{service.summary}</p>}
|
|
47
|
+
</div>
|
|
48
|
+
<div class="sv-row-price">
|
|
49
|
+
{service.price && (
|
|
50
|
+
<>
|
|
51
|
+
{s.startingLabel && <p class="sv-row-from">{s.startingLabel}</p>}
|
|
52
|
+
<p class="sv-row-amount">{service.price}</p>
|
|
53
|
+
</>
|
|
54
|
+
)}
|
|
55
|
+
{service.term && <p class="sv-row-term">{service.term}</p>}
|
|
56
|
+
</div>
|
|
57
|
+
{service.link && (
|
|
58
|
+
<div class="sv-row-action">
|
|
59
|
+
<Button service={service} solid={service.featured} many={many} />
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
</li>
|
|
63
|
+
))}
|
|
64
|
+
</ul>
|
|
65
|
+
)}
|
|
66
|
+
{s.note && <p class="fine sv-rows-note">{s.note}</p>}
|
|
67
|
+
</Band>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
<style>
|
|
71
|
+
.sv-rows {
|
|
72
|
+
display: grid;
|
|
73
|
+
gap: 0.75rem;
|
|
74
|
+
margin: 0;
|
|
75
|
+
padding: 0;
|
|
76
|
+
list-style: none;
|
|
77
|
+
}
|
|
78
|
+
:global(.lede) + .sv-rows {
|
|
79
|
+
margin-top: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
|
|
80
|
+
}
|
|
81
|
+
.sv-row {
|
|
82
|
+
display: grid;
|
|
83
|
+
gap: 1rem 1.5rem;
|
|
84
|
+
min-width: 0;
|
|
85
|
+
padding: clamp(1.125rem, 0.9rem + 0.8vw, 1.5rem) clamp(1.125rem, 0.8rem + 1.2vw, 1.75rem);
|
|
86
|
+
border: 1px solid var(--line);
|
|
87
|
+
border-radius: var(--radius-card);
|
|
88
|
+
background: var(--surface);
|
|
89
|
+
color: var(--ink);
|
|
90
|
+
}
|
|
91
|
+
:global(.bg-band-contrast) .sv-row {
|
|
92
|
+
background: color-mix(in srgb, var(--ink) 7%, transparent);
|
|
93
|
+
}
|
|
94
|
+
.sv-row-featured {
|
|
95
|
+
border-color: var(--line-strong);
|
|
96
|
+
box-shadow: var(--shadow);
|
|
97
|
+
}
|
|
98
|
+
.sv-row-words {
|
|
99
|
+
min-width: 0;
|
|
100
|
+
}
|
|
101
|
+
.sv-row-head {
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-wrap: wrap;
|
|
104
|
+
align-items: center;
|
|
105
|
+
gap: 0.375rem 0.75rem;
|
|
106
|
+
}
|
|
107
|
+
/* The featured label's chip, outlined so it reads on a surface as dark as the tint (a dark scheme). */
|
|
108
|
+
.sv-row-head .chip {
|
|
109
|
+
box-shadow: inset 0 0 0 1px var(--line-strong);
|
|
110
|
+
}
|
|
111
|
+
.sv-row-name {
|
|
112
|
+
margin: 0;
|
|
113
|
+
font-family: var(--font);
|
|
114
|
+
font-size: 1.0625rem;
|
|
115
|
+
font-weight: 700;
|
|
116
|
+
letter-spacing: 0;
|
|
117
|
+
line-height: 1.35;
|
|
118
|
+
}
|
|
119
|
+
.sv-row-summary {
|
|
120
|
+
margin: 0.25rem 0 0;
|
|
121
|
+
max-width: var(--measure);
|
|
122
|
+
color: var(--muted);
|
|
123
|
+
font-size: 0.9375rem;
|
|
124
|
+
line-height: 1.5;
|
|
125
|
+
}
|
|
126
|
+
.sv-row-price {
|
|
127
|
+
min-width: 0;
|
|
128
|
+
}
|
|
129
|
+
.sv-row-price p {
|
|
130
|
+
margin: 0;
|
|
131
|
+
}
|
|
132
|
+
.sv-row-from {
|
|
133
|
+
color: var(--muted);
|
|
134
|
+
font-size: var(--text-xs);
|
|
135
|
+
font-weight: 700;
|
|
136
|
+
letter-spacing: 0.16em;
|
|
137
|
+
line-height: 1.4;
|
|
138
|
+
text-transform: uppercase;
|
|
139
|
+
}
|
|
140
|
+
.sv-row-amount {
|
|
141
|
+
font-family: var(--font-display);
|
|
142
|
+
font-size: clamp(1.375rem, 1.2rem + 0.5vw, 1.625rem);
|
|
143
|
+
font-variant-numeric: lining-nums;
|
|
144
|
+
font-weight: 800;
|
|
145
|
+
letter-spacing: -0.015em;
|
|
146
|
+
line-height: 1.15;
|
|
147
|
+
}
|
|
148
|
+
.sv-row-term {
|
|
149
|
+
margin-top: 0.125rem;
|
|
150
|
+
color: var(--muted);
|
|
151
|
+
font-size: var(--text-sm);
|
|
152
|
+
}
|
|
153
|
+
.sv-rows-note {
|
|
154
|
+
margin: 1.25rem 0 0;
|
|
155
|
+
}
|
|
156
|
+
/* On a phone the price and the button share a line under the words, the button at the right. */
|
|
157
|
+
@media (max-width: 47.99rem) {
|
|
158
|
+
.sv-row {
|
|
159
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
160
|
+
align-items: end;
|
|
161
|
+
}
|
|
162
|
+
.sv-row-words {
|
|
163
|
+
grid-column: 1 / -1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/* Wider, the rows share their columns, so the prices and the buttons line up down the list. */
|
|
167
|
+
@media (min-width: 48rem) {
|
|
168
|
+
.sv-rows {
|
|
169
|
+
grid-template-columns: minmax(0, 1fr) minmax(9rem, max-content) max-content;
|
|
170
|
+
}
|
|
171
|
+
.sv-row {
|
|
172
|
+
grid-column: 1 / -1;
|
|
173
|
+
grid-template-columns: subgrid;
|
|
174
|
+
align-items: center;
|
|
175
|
+
column-gap: clamp(1.5rem, 3vw, 2.5rem);
|
|
176
|
+
}
|
|
177
|
+
.sv-row-action :global(.button) {
|
|
178
|
+
width: 100%;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// A Services section's rows as its layouts draw them: what the organization
|
|
2
|
+
// offers and what it costs, each row typed by the operator in BackGold. The
|
|
3
|
+
// price and the term are the operator's own words ("$4,500/mo", "15% of
|
|
4
|
+
// spend", "3-month minimum") and are drawn as written: nothing here reads a
|
|
5
|
+
// number out of them, rounds them or adds them up.
|
|
6
|
+
//
|
|
7
|
+
// A row is drawn when it has a name; a row without one is left out. Its
|
|
8
|
+
// button goes to the row's address, worded by its `buttonLabel` or
|
|
9
|
+
// "Details", and is left out when the address is missing or unsafe. The first
|
|
10
|
+
// row flagged `featured` is the featured one (a second flag is not a second
|
|
11
|
+
// favourite); the copy's `featuredLabel` is the only words that say so, and
|
|
12
|
+
// only when the operator wrote it.
|
|
13
|
+
|
|
14
|
+
import type { Section } from '@backgold/content'
|
|
15
|
+
import { linkOf, rows, type Link } from '../../../lib/section'
|
|
16
|
+
import { text } from '../../../lib/format'
|
|
17
|
+
|
|
18
|
+
/** A button's words when the row names none. */
|
|
19
|
+
const DETAILS = 'Details'
|
|
20
|
+
|
|
21
|
+
export interface Service {
|
|
22
|
+
name: string
|
|
23
|
+
summary: string | null
|
|
24
|
+
/** The price as typed: "$1,500", "$4,500/mo", "15% of spend". */
|
|
25
|
+
price: string | null
|
|
26
|
+
/** The terms as typed: "One time, two weeks", "3-month minimum". */
|
|
27
|
+
term: string | null
|
|
28
|
+
/** What the service includes, in the row's order. */
|
|
29
|
+
includes: string[]
|
|
30
|
+
/** The row's button, or null when it has no safe address. */
|
|
31
|
+
link: Link | null
|
|
32
|
+
featured: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface Services {
|
|
36
|
+
items: Service[]
|
|
37
|
+
/** The featured service, or null when no row is flagged. */
|
|
38
|
+
featured: Service | null
|
|
39
|
+
featuredLabel: string | null
|
|
40
|
+
startingLabel: string | null
|
|
41
|
+
note: string | null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function strings(value: unknown): string[] {
|
|
45
|
+
return Array.isArray(value) ? value.map(text).filter((s): s is string => s !== null).map((s) => s.trim()) : []
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The section's services, in the operator's order. */
|
|
49
|
+
export function servicesOf(section: Section): Services {
|
|
50
|
+
let flagged = false
|
|
51
|
+
const items = rows(section).flatMap((row): Service[] => {
|
|
52
|
+
const name = text(row.name)?.trim()
|
|
53
|
+
if (!name) return []
|
|
54
|
+
const featured = row.featured === true && !flagged
|
|
55
|
+
if (featured) flagged = true
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
name,
|
|
59
|
+
summary: text(row.summary)?.trim() ?? null,
|
|
60
|
+
price: text(row.price)?.trim() ?? null,
|
|
61
|
+
term: text(row.term)?.trim() ?? null,
|
|
62
|
+
includes: strings(row.includes),
|
|
63
|
+
link: linkOf(text(row.buttonLabel)?.trim() ?? DETAILS, row.href),
|
|
64
|
+
featured,
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
return {
|
|
69
|
+
items,
|
|
70
|
+
featured: items.find((s) => s.featured) ?? null,
|
|
71
|
+
featuredLabel: text(section.copy.featuredLabel)?.trim() ?? null,
|
|
72
|
+
startingLabel: text(section.copy.startingLabel)?.trim() ?? null,
|
|
73
|
+
note: text(section.copy.note)?.trim() ?? null,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Every distinct line the services include, in the order they first appear. */
|
|
78
|
+
export function everyInclude(items: Service[]): string[] {
|
|
79
|
+
return [...new Set(items.flatMap((s) => s.includes))]
|
|
80
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The Share kit's island, placed once per section as the last child of the
|
|
3
|
+
// element marked `data-share-kit`. For each post (`[data-share-item]`, its
|
|
4
|
+
// words in `data-share-text`) it shows the Copy button where the browser can
|
|
5
|
+
// write the clipboard and the Share button where it has a share sheet, both
|
|
6
|
+
// drawn hidden (Buttons.astro). Copy writes the post's words, nothing else;
|
|
7
|
+
// its label reads "Copied" for two seconds and the status line says which
|
|
8
|
+
// post was copied. Share opens the device's own sheet with the words alone.
|
|
9
|
+
// The row's link is never copied or shared: any address the post carries is
|
|
10
|
+
// written into its words by the operator. Nothing is counted,
|
|
11
|
+
// stored or sent anywhere: the visitor's device does the sharing. Without
|
|
12
|
+
// script nothing here runs and each post is its words and its plain link.
|
|
13
|
+
---
|
|
14
|
+
<p class="visually-hidden" role="status" aria-live="polite" data-share-status></p>
|
|
15
|
+
<script is:inline>
|
|
16
|
+
;(function (root) {
|
|
17
|
+
if (!root) return
|
|
18
|
+
var canCopy = !!(navigator.clipboard && navigator.clipboard.writeText)
|
|
19
|
+
var canShare = typeof navigator.share === 'function'
|
|
20
|
+
if (!canCopy && !canShare) return
|
|
21
|
+
var status = root.querySelector('[data-share-status]')
|
|
22
|
+
var say = function (words) {
|
|
23
|
+
status.textContent = ''
|
|
24
|
+
setTimeout(function () {
|
|
25
|
+
status.textContent = words
|
|
26
|
+
}, 50)
|
|
27
|
+
}
|
|
28
|
+
var arm = function (item) {
|
|
29
|
+
var words = item.getAttribute('data-share-text') || ''
|
|
30
|
+
var name = item.getAttribute('data-share-name') || 'the post'
|
|
31
|
+
var buttons = item.querySelector('[data-share-buttons]')
|
|
32
|
+
var copy = item.querySelector('[data-share-copy]')
|
|
33
|
+
var share = item.querySelector('[data-share-share]')
|
|
34
|
+
if (!words || !buttons) return
|
|
35
|
+
if (canCopy && copy) {
|
|
36
|
+
var label = copy.querySelector('[data-share-copy-label]')
|
|
37
|
+
var word = label.textContent
|
|
38
|
+
var timer = 0
|
|
39
|
+
copy.addEventListener('click', function () {
|
|
40
|
+
navigator.clipboard.writeText(words).then(
|
|
41
|
+
function () {
|
|
42
|
+
label.textContent = 'Copied'
|
|
43
|
+
copy.setAttribute('data-copied', '')
|
|
44
|
+
say('Copied ' + name + '.')
|
|
45
|
+
clearTimeout(timer)
|
|
46
|
+
timer = setTimeout(function () {
|
|
47
|
+
label.textContent = word
|
|
48
|
+
copy.removeAttribute('data-copied')
|
|
49
|
+
}, 2000)
|
|
50
|
+
},
|
|
51
|
+
function () {
|
|
52
|
+
say('Could not copy. Select the words and copy them instead.')
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
copy.hidden = false
|
|
57
|
+
}
|
|
58
|
+
if (canShare && share) {
|
|
59
|
+
share.addEventListener('click', function () {
|
|
60
|
+
navigator.share({ text: words }).catch(function (e) {
|
|
61
|
+
if (!e || e.name !== 'AbortError') say('Could not open the share sheet. Copy the post instead.')
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
share.hidden = false
|
|
65
|
+
}
|
|
66
|
+
buttons.hidden = false
|
|
67
|
+
}
|
|
68
|
+
var items = root.querySelectorAll('[data-share-item]')
|
|
69
|
+
for (var i = 0; i < items.length; i++) arm(items[i])
|
|
70
|
+
})(document.currentScript && document.currentScript.closest('[data-share-kit]'))
|
|
71
|
+
</script>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A post's Copy and Share buttons, drawn inside its `[data-share-item]` by
|
|
3
|
+
// every Share kit layout. Both are drawn `hidden`: the section's island
|
|
4
|
+
// (Actions.astro) shows Copy where the browser can write the clipboard and
|
|
5
|
+
// Share where it has a share sheet (`navigator.share`), so with scripts off,
|
|
6
|
+
// or on a browser without either, no button is offered that cannot work and
|
|
7
|
+
// the post is its words and its plain link. A screen reader hears which
|
|
8
|
+
// post each button acts on ("Copy the X post").
|
|
9
|
+
import type { Post } from './share'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
post: Post
|
|
13
|
+
labels: { copy: string; share: string }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { post, labels } = Astro.props
|
|
17
|
+
---
|
|
18
|
+
<p class="share-buttons" data-share-buttons hidden>
|
|
19
|
+
<button type="button" class="button button-small button-quiet share-button" data-share-copy hidden>
|
|
20
|
+
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
|
|
21
|
+
<path d="M9 9h10v11H9zM5 15V4h10" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" />
|
|
22
|
+
</svg>
|
|
23
|
+
<span data-share-copy-label>{labels.copy}</span><span class="visually-hidden"> {post.name}</span>
|
|
24
|
+
</button>
|
|
25
|
+
<button type="button" class="button button-small button-quiet share-button" data-share-share hidden>
|
|
26
|
+
<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true" focusable="false">
|
|
27
|
+
<path d="M12 15V3M7 8l5-5 5 5M5 12v8h14v-8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
28
|
+
</svg>
|
|
29
|
+
<span>{labels.share}</span><span class="visually-hidden"> {post.name}</span>
|
|
30
|
+
</button>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.share-buttons {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
gap: 0.5rem;
|
|
38
|
+
margin: 0;
|
|
39
|
+
}
|
|
40
|
+
.share-buttons[hidden],
|
|
41
|
+
.share-button[hidden] {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
.share-button {
|
|
45
|
+
gap: 0.375rem;
|
|
46
|
+
min-height: 2.75rem;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
font-family: inherit;
|
|
49
|
+
}
|
|
50
|
+
.share-button svg {
|
|
51
|
+
flex: 0 0 auto;
|
|
52
|
+
}
|
|
53
|
+
/* "Copied": the button wears the band's soft ground for as long as it says so. */
|
|
54
|
+
.share-button[data-copied] {
|
|
55
|
+
background: color-mix(in srgb, var(--ink) 8%, transparent);
|
|
56
|
+
}
|
|
57
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
58
|
+
.share-button {
|
|
59
|
+
transition: background-color 0.15s ease;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|