@backgold/template-kit 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/chunk-RJAVFRC6.js +67 -0
- package/dist/constants-BAIo_Q5U.d-lQbj1e1-.d.ts +48 -0
- package/dist/content-api-Cox1-wz5.d.ts +1096 -0
- package/dist/contract/content-api-examples.d.ts +72 -0
- package/dist/contract/content-api-examples.js +926 -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 +253 -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 +61 -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 +80 -0
- package/src/components/sections/About/index.astro +60 -0
- package/src/components/sections/About/left.astro +57 -0
- package/src/components/sections/About/letter.astro +111 -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 +126 -0
- package/src/components/sections/ContentPost/player.astro +254 -0
- package/src/components/sections/ContentPost/prose.astro +80 -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 +176 -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 +99 -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/Lookup.astro +43 -0
- package/src/components/sections/VoterTools/dates.astro +153 -0
- package/src/components/sections/VoterTools/index.astro +231 -0
- package/src/components/sections/VoterTools/polling.astro +144 -0
- package/src/components/sections/VoterTools/voter-tools.ts +71 -0
- package/src/components/sections/index.ts +373 -0
- package/src/components/sections/modules/Headed.astro +39 -0
- package/src/components/sections/modules/ModuleFrame.astro +181 -0
- package/src/components/store/CollectionPage.astro +40 -0
- package/src/components/store/ProductCard.astro +32 -0
- package/src/components/store/ProductGrid.astro +16 -0
- package/src/components/store/ProductPage.astro +146 -0
- package/src/components/store/StorePage.astro +137 -0
- package/src/components/store/StoreScript.astro +572 -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 +63 -0
- package/src/layouts/Site.astro +387 -0
- package/src/lib/academy.ts +146 -0
- package/src/lib/brand.ts +534 -0
- package/src/lib/chrome.ts +121 -0
- package/src/lib/donate-frame.ts +104 -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 +55 -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 +105 -0
- package/src/lib/shifts.ts +187 -0
- package/src/lib/store.ts +521 -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 +435 -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/styles/entries.css +784 -0
- package/src/styles/site.css +1910 -0
- package/src/styles/store.css +634 -0
- package/src/template.ts +182 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
---
|
|
2
|
+
// CaseStudies · Featured, the default (board S06, A): the kicker and
|
|
3
|
+
// heading, the line of copy, then the first case large: its picture at the
|
|
4
|
+
// left with rounded corners (the row's own, else the section's), and at the
|
|
5
|
+
// right its tag as a chip, its title in the display face, the challenge and
|
|
6
|
+
// the approach each as a line with its bold label (a line with no words is
|
|
7
|
+
// left out), the figures it has as a row of large numerals in the accent
|
|
8
|
+
// with their labels under them, and the read button: the section's read
|
|
9
|
+
// words to the case's own address, else to the section's read link. A case
|
|
10
|
+
// with no figures shows its result as a third line instead, so it never
|
|
11
|
+
// reads as a story without an end.
|
|
12
|
+
//
|
|
13
|
+
// With no picture anywhere, the tag is set large in the display face on a
|
|
14
|
+
// panel of the band's surface in the picture's place (and not repeated as a
|
|
15
|
+
// chip); with neither a picture nor a tag, the words take the full width on
|
|
16
|
+
// the surface. The title is an <h3>, or an <h2> when the section has no
|
|
17
|
+
// heading of its own.
|
|
18
|
+
//
|
|
19
|
+
// The other cases follow under a thin rule as compact cards, three across on
|
|
20
|
+
// a wide screen, two on a tablet and one on a phone: the tag small in
|
|
21
|
+
// capitals, the title (the whole card is its link when the row has one) and
|
|
22
|
+
// the hero figure with its label. The note sits small at the end. With no
|
|
23
|
+
// case and no heading it draws nothing.
|
|
24
|
+
import type { Section } from '@backgold/content'
|
|
25
|
+
import Band from '../Band.astro'
|
|
26
|
+
import SectionHead from '../SectionHead.astro'
|
|
27
|
+
import Prose from '../../Prose.astro'
|
|
28
|
+
import { casesOf, readFor } from './cases'
|
|
29
|
+
import { media } from '../../../lib/section'
|
|
30
|
+
import { text } from '../../../lib/format'
|
|
31
|
+
|
|
32
|
+
interface Props {
|
|
33
|
+
section: Section
|
|
34
|
+
variant?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const { section } = Astro.props
|
|
38
|
+
const kicker = text(section.copy.kicker)
|
|
39
|
+
const heading = text(section.copy.heading)
|
|
40
|
+
const note = text(section.copy.note)
|
|
41
|
+
const cases = casesOf(section)
|
|
42
|
+
const [lead, ...rest] = cases
|
|
43
|
+
const picture = lead?.photo ? { url: lead.photo, alt: '' } : media(section, 'imageUrl')
|
|
44
|
+
const panel = !picture && lead?.tag ? lead.tag : null
|
|
45
|
+
const read = lead ? readFor(section, lead) : null
|
|
46
|
+
const lines = lead
|
|
47
|
+
? [
|
|
48
|
+
{ label: 'Challenge:', words: lead.challenge },
|
|
49
|
+
{ label: 'Approach:', words: lead.approach },
|
|
50
|
+
{ label: 'Result:', words: lead.metrics.length === 0 ? lead.result : null },
|
|
51
|
+
].filter((line) => line.words)
|
|
52
|
+
: []
|
|
53
|
+
const Title = heading ? 'h3' : 'h2'
|
|
54
|
+
---
|
|
55
|
+
{(heading || lead) && (
|
|
56
|
+
<Band section={section} class="cases cases-featured">
|
|
57
|
+
<div class="cases-intro">
|
|
58
|
+
<SectionHead kicker={kicker} heading={heading} more={[]} />
|
|
59
|
+
<Prose value={section.copy.body} class="lede" />
|
|
60
|
+
</div>
|
|
61
|
+
{lead && (
|
|
62
|
+
<article class:list={['case-lead', picture || panel ? 'case-lead-pictured' : 'case-lead-words-only']}>
|
|
63
|
+
{picture && (
|
|
64
|
+
<div class="case-lead-media">
|
|
65
|
+
<img class="case-lead-photo" src={picture.url} alt={picture.alt} loading="lazy" decoding="async" />
|
|
66
|
+
</div>
|
|
67
|
+
)}
|
|
68
|
+
{panel && (
|
|
69
|
+
<div class="case-lead-media case-lead-panel">
|
|
70
|
+
<p class="case-lead-panel-tag">{panel}</p>
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
<div class="case-lead-words">
|
|
74
|
+
{lead.tag && !panel && <p class="case-lead-tag"><span class="chip">{lead.tag}</span></p>}
|
|
75
|
+
<Title class="case-lead-title">{lead.title}</Title>
|
|
76
|
+
{lines.map((line) => (
|
|
77
|
+
<p class="case-lead-line"><strong>{line.label}</strong> {line.words}</p>
|
|
78
|
+
))}
|
|
79
|
+
{lead.metrics.length > 0 && (
|
|
80
|
+
<ul class="case-figures" role="list">
|
|
81
|
+
{lead.metrics.map((m) => (
|
|
82
|
+
<li>
|
|
83
|
+
<p class="case-figure">{m.value}</p>
|
|
84
|
+
{m.label && <p class="case-figure-label">{m.label}</p>}
|
|
85
|
+
</li>
|
|
86
|
+
))}
|
|
87
|
+
</ul>
|
|
88
|
+
)}
|
|
89
|
+
{read && (
|
|
90
|
+
<p class="actions case-lead-actions">
|
|
91
|
+
<a class="button" href={read.href} rel={read.rel}>{read.label}</a>
|
|
92
|
+
</p>
|
|
93
|
+
)}
|
|
94
|
+
</div>
|
|
95
|
+
</article>
|
|
96
|
+
)}
|
|
97
|
+
{rest.length > 0 && (
|
|
98
|
+
<ul class="case-cards" role="list">
|
|
99
|
+
{rest.map((c) => (
|
|
100
|
+
<li class:list={['case-card', c.link && 'case-card-linked']}>
|
|
101
|
+
{c.tag && <p class="case-card-tag">{c.tag}</p>}
|
|
102
|
+
<Title class="case-card-title">{c.link ? <a href={c.link.href} rel={c.link.rel}>{c.title}</a> : c.title}</Title>
|
|
103
|
+
{c.hero && (
|
|
104
|
+
<p class="case-card-figure">
|
|
105
|
+
<span class="case-card-value">{c.hero.value}</span>
|
|
106
|
+
{c.hero.label && <span class="case-card-label">{c.hero.label}</span>}
|
|
107
|
+
</p>
|
|
108
|
+
)}
|
|
109
|
+
</li>
|
|
110
|
+
))}
|
|
111
|
+
</ul>
|
|
112
|
+
)}
|
|
113
|
+
{lead && note && <p class="fine cases-note">{note}</p>}
|
|
114
|
+
</Band>
|
|
115
|
+
)}
|
|
116
|
+
|
|
117
|
+
<style>
|
|
118
|
+
.cases-intro > :global(.lede) {
|
|
119
|
+
margin: -0.5rem 0 1.75rem;
|
|
120
|
+
}
|
|
121
|
+
.cases-intro:last-child > :global(.lede) {
|
|
122
|
+
margin-bottom: 0;
|
|
123
|
+
}
|
|
124
|
+
.case-lead {
|
|
125
|
+
display: grid;
|
|
126
|
+
gap: 1.5rem;
|
|
127
|
+
}
|
|
128
|
+
.case-lead-media {
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
border-radius: var(--radius-card);
|
|
131
|
+
}
|
|
132
|
+
.case-lead-photo {
|
|
133
|
+
display: block;
|
|
134
|
+
width: 100%;
|
|
135
|
+
aspect-ratio: 4 / 3;
|
|
136
|
+
object-fit: cover;
|
|
137
|
+
}
|
|
138
|
+
/* No picture: the tag large on the band's surface, ruled in the accent at its foot. */
|
|
139
|
+
.case-lead-panel {
|
|
140
|
+
display: grid;
|
|
141
|
+
place-items: center;
|
|
142
|
+
aspect-ratio: 2 / 1;
|
|
143
|
+
padding: clamp(1.25rem, 1rem + 2vw, 2.5rem);
|
|
144
|
+
border: 1px solid var(--line);
|
|
145
|
+
background: var(--surface);
|
|
146
|
+
box-shadow: inset 0 -3px 0 var(--accent);
|
|
147
|
+
}
|
|
148
|
+
.case-lead-panel-tag {
|
|
149
|
+
margin: 0;
|
|
150
|
+
font-family: var(--font-display);
|
|
151
|
+
font-size: clamp(2rem, 1.5rem + 2.2vw, 3.25rem);
|
|
152
|
+
font-weight: 800;
|
|
153
|
+
line-height: 1.05;
|
|
154
|
+
letter-spacing: -0.02em;
|
|
155
|
+
text-align: center;
|
|
156
|
+
text-wrap: balance;
|
|
157
|
+
overflow-wrap: anywhere;
|
|
158
|
+
}
|
|
159
|
+
.case-lead-words > * {
|
|
160
|
+
margin: 0;
|
|
161
|
+
}
|
|
162
|
+
.case-lead-tag .chip {
|
|
163
|
+
white-space: normal;
|
|
164
|
+
}
|
|
165
|
+
.case-lead-words .case-lead-title {
|
|
166
|
+
margin-top: 0.875rem;
|
|
167
|
+
font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem);
|
|
168
|
+
font-weight: 800;
|
|
169
|
+
line-height: 1.08;
|
|
170
|
+
}
|
|
171
|
+
.case-lead-words > .case-lead-title:first-child {
|
|
172
|
+
margin-top: 0;
|
|
173
|
+
}
|
|
174
|
+
.case-lead-words .case-lead-line {
|
|
175
|
+
margin-top: 0.75rem;
|
|
176
|
+
color: var(--muted);
|
|
177
|
+
max-width: var(--measure);
|
|
178
|
+
}
|
|
179
|
+
.case-lead-title + .case-lead-line {
|
|
180
|
+
margin-top: 1rem;
|
|
181
|
+
}
|
|
182
|
+
.case-lead-line strong {
|
|
183
|
+
color: var(--ink);
|
|
184
|
+
}
|
|
185
|
+
.case-lead-words .case-figures {
|
|
186
|
+
display: flex;
|
|
187
|
+
flex-wrap: wrap;
|
|
188
|
+
gap: 1rem 1.25rem;
|
|
189
|
+
margin-top: 1.375rem;
|
|
190
|
+
padding: 1.125rem 0 0;
|
|
191
|
+
border-top: 1px solid var(--line);
|
|
192
|
+
list-style: none;
|
|
193
|
+
}
|
|
194
|
+
/* Three across down to a phone; a figure too wide for its third takes a line of its own rather than breaking. */
|
|
195
|
+
.case-figures li {
|
|
196
|
+
flex: 1 1 5.25rem;
|
|
197
|
+
}
|
|
198
|
+
.case-figures p {
|
|
199
|
+
margin: 0;
|
|
200
|
+
}
|
|
201
|
+
.case-figure {
|
|
202
|
+
color: var(--accent);
|
|
203
|
+
font-family: var(--font-display);
|
|
204
|
+
font-size: clamp(1.875rem, 1.5rem + 1.2vw, 2.5rem);
|
|
205
|
+
font-weight: 800;
|
|
206
|
+
font-variant-numeric: lining-nums;
|
|
207
|
+
line-height: 1;
|
|
208
|
+
letter-spacing: -0.02em;
|
|
209
|
+
overflow-wrap: break-word;
|
|
210
|
+
}
|
|
211
|
+
.case-figure-label {
|
|
212
|
+
margin-top: 0.375rem;
|
|
213
|
+
color: var(--muted);
|
|
214
|
+
font-size: var(--text-sm);
|
|
215
|
+
line-height: 1.35;
|
|
216
|
+
}
|
|
217
|
+
.case-lead-words .case-lead-actions {
|
|
218
|
+
margin-top: 1.5rem;
|
|
219
|
+
}
|
|
220
|
+
.case-lead-words-only .case-lead-words {
|
|
221
|
+
padding: 1.5rem 1.25rem 1.625rem;
|
|
222
|
+
border: 1px solid var(--line);
|
|
223
|
+
border-radius: var(--radius-card);
|
|
224
|
+
background: var(--surface);
|
|
225
|
+
}
|
|
226
|
+
.case-cards {
|
|
227
|
+
display: grid;
|
|
228
|
+
grid-template-columns: minmax(0, 1fr);
|
|
229
|
+
gap: 1rem;
|
|
230
|
+
margin: clamp(2rem, 1.5rem + 1.5vw, 2.75rem) 0 0;
|
|
231
|
+
padding: clamp(2rem, 1.5rem + 1.5vw, 2.75rem) 0 0;
|
|
232
|
+
border-top: 1px solid var(--line);
|
|
233
|
+
list-style: none;
|
|
234
|
+
}
|
|
235
|
+
.case-card {
|
|
236
|
+
position: relative;
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: 0.5rem;
|
|
240
|
+
min-width: 0;
|
|
241
|
+
padding: 1.25rem 1.25rem 1.375rem;
|
|
242
|
+
border: 1px solid var(--line);
|
|
243
|
+
border-radius: var(--radius-card);
|
|
244
|
+
background: var(--surface);
|
|
245
|
+
}
|
|
246
|
+
.case-card > * {
|
|
247
|
+
margin: 0;
|
|
248
|
+
}
|
|
249
|
+
.case-card-tag {
|
|
250
|
+
color: var(--muted);
|
|
251
|
+
font-size: var(--text-xs);
|
|
252
|
+
font-weight: 700;
|
|
253
|
+
letter-spacing: 0.12em;
|
|
254
|
+
line-height: 1.4;
|
|
255
|
+
text-transform: uppercase;
|
|
256
|
+
}
|
|
257
|
+
.case-card .case-card-title {
|
|
258
|
+
font-size: calc(var(--h3) * 0.9);
|
|
259
|
+
font-weight: 700;
|
|
260
|
+
line-height: 1.2;
|
|
261
|
+
}
|
|
262
|
+
.case-card-title a {
|
|
263
|
+
color: var(--ink);
|
|
264
|
+
text-decoration: none;
|
|
265
|
+
}
|
|
266
|
+
.case-card-title a::after {
|
|
267
|
+
content: '';
|
|
268
|
+
position: absolute;
|
|
269
|
+
inset: 0;
|
|
270
|
+
}
|
|
271
|
+
.case-card-linked:hover .case-card-title a {
|
|
272
|
+
text-decoration: underline;
|
|
273
|
+
}
|
|
274
|
+
.case-card-linked:focus-within {
|
|
275
|
+
outline: 3px solid var(--ink);
|
|
276
|
+
outline-offset: 3px;
|
|
277
|
+
}
|
|
278
|
+
.case-card-title a:focus-visible {
|
|
279
|
+
outline: none;
|
|
280
|
+
}
|
|
281
|
+
.case-card .case-card-figure {
|
|
282
|
+
display: flex;
|
|
283
|
+
flex-wrap: wrap;
|
|
284
|
+
align-items: baseline;
|
|
285
|
+
gap: 0.25rem 0.625rem;
|
|
286
|
+
margin-top: auto;
|
|
287
|
+
padding-top: 0.875rem;
|
|
288
|
+
border-top: 1px solid var(--line);
|
|
289
|
+
}
|
|
290
|
+
.case-card-value {
|
|
291
|
+
color: var(--accent);
|
|
292
|
+
font-family: var(--font-display);
|
|
293
|
+
font-size: 1.75rem;
|
|
294
|
+
font-weight: 800;
|
|
295
|
+
font-variant-numeric: lining-nums;
|
|
296
|
+
line-height: 1;
|
|
297
|
+
letter-spacing: -0.02em;
|
|
298
|
+
overflow-wrap: anywhere;
|
|
299
|
+
}
|
|
300
|
+
.case-card-label {
|
|
301
|
+
color: var(--muted);
|
|
302
|
+
font-size: var(--text-sm);
|
|
303
|
+
line-height: 1.35;
|
|
304
|
+
}
|
|
305
|
+
.cases-note {
|
|
306
|
+
margin: 1.25rem 0 0;
|
|
307
|
+
}
|
|
308
|
+
@media (min-width: 40rem) {
|
|
309
|
+
.case-cards {
|
|
310
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
311
|
+
gap: 1.25rem;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
@media (min-width: 48rem) {
|
|
315
|
+
.case-lead-pictured {
|
|
316
|
+
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
|
|
317
|
+
gap: clamp(2rem, 4vw, 3rem);
|
|
318
|
+
align-items: center;
|
|
319
|
+
}
|
|
320
|
+
.case-lead-panel {
|
|
321
|
+
aspect-ratio: 4 / 3;
|
|
322
|
+
}
|
|
323
|
+
.case-lead-words-only .case-lead-words {
|
|
324
|
+
padding: 2.25rem 2.5rem 2.5rem;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
@media (min-width: 60rem) {
|
|
328
|
+
.case-cards {
|
|
329
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
330
|
+
gap: 1.5rem;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
</style>
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
// One course on a Classroom (board D1): its cover with the lesson count on
|
|
3
|
+
// it, the title (the whole card is the link to the course), its line, and
|
|
4
|
+
// under them what this reader needs to know. With a visitor: the bar and
|
|
5
|
+
// "4 of 12 lessons" with "38 min left", "Not started · 52 min" or
|
|
6
|
+
// "Finished"; on a course they cannot open, the lock's word ("For members"),
|
|
7
|
+
// the count and length, and for a members course "Join <org> to start this
|
|
8
|
+
// course.". Signed out: what it takes to watch ("Free with your email",
|
|
9
|
+
// "For members") and "12 lessons · 1 h 1 min". `layout` is the section's:
|
|
10
|
+
// a card in the grid, or a row in the list.
|
|
11
|
+
import Bar from '../Course/Bar.astro'
|
|
12
|
+
import Icon from '../Course/Icon.astro'
|
|
13
|
+
import type { CourseCard } from './classroom'
|
|
14
|
+
import { accessChipOf, countAndLength, leftOf, lengthOf, lessonsOf, lockWordOf, stateOf } from '../../../lib/academy'
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
card: CourseCard
|
|
18
|
+
signedIn: boolean
|
|
19
|
+
/** The organization's name (the site's), for the members card's line. */
|
|
20
|
+
orgName: string | null
|
|
21
|
+
level: 2 | 3
|
|
22
|
+
layout: 'grid' | 'list'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { card, signedIn, orgName, level, layout } = Astro.props
|
|
26
|
+
const Title = level === 2 ? 'h2' : 'h3'
|
|
27
|
+
const tracked = signedIn && !card.locked && card.progress ? card.progress : null
|
|
28
|
+
const state = tracked ? stateOf(tracked) : null
|
|
29
|
+
const length = lengthOf(card.seconds)
|
|
30
|
+
const chip = signedIn && card.locked && card.lock ? lockWordOf(card.lock) : accessChipOf(card.access, card.lock?.tag_label ?? null)
|
|
31
|
+
const lockedChip = card.access === 'members' || card.access === 'tag'
|
|
32
|
+
const join = signedIn && card.locked && card.lock?.reason === 'members' ? (orgName ? `Join ${orgName} to start this course.` : 'Join to start this course.') : null
|
|
33
|
+
---
|
|
34
|
+
<article class:list={['card', 'cr-card', `cr-${layout}`]}>
|
|
35
|
+
<div class="cr-cover">
|
|
36
|
+
{card.cover ? <img src={card.cover} alt="" loading="lazy" decoding="async" /> : <span class="cr-cover-blank" aria-hidden="true"></span>}
|
|
37
|
+
<span class="chip cr-count">{lessonsOf(card.lessons)}</span>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="card-body cr-body">
|
|
40
|
+
<Title class="card-title cr-title">{card.href ? <a href={card.href}>{card.title}</a> : card.title}</Title>
|
|
41
|
+
{card.summary && <p class="card-summary cr-summary">{card.summary}</p>}
|
|
42
|
+
{tracked && state ? (
|
|
43
|
+
<div class="cr-status">
|
|
44
|
+
<Bar completed={tracked.completed} total={tracked.total} label={`${card.title}: ${tracked.completed} of ${tracked.total} lessons`} />
|
|
45
|
+
<p class="cr-figures">
|
|
46
|
+
<span>{tracked.completed} of {tracked.total} lessons</span>
|
|
47
|
+
{state === 'finished' && <span class="cr-state cr-done"><Icon name="check" /> Finished</span>}
|
|
48
|
+
{state === 'new' && <span class="cr-state">{length ? `Not started · ${length}` : 'Not started'}</span>}
|
|
49
|
+
{state === 'started' && leftOf(tracked) && <span class="cr-state">{leftOf(tracked)}</span>}
|
|
50
|
+
</p>
|
|
51
|
+
</div>
|
|
52
|
+
) : (
|
|
53
|
+
<div class="cr-status">
|
|
54
|
+
<p class="cr-figures cr-access">
|
|
55
|
+
<span class:list={['cr-chip', lockedChip && 'cr-chip-locked']}>{lockedChip && <Icon name="lock" />} {chip}</span>
|
|
56
|
+
<span class="cr-state">{countAndLength(card.lessons, card.seconds)}</span>
|
|
57
|
+
</p>
|
|
58
|
+
{join && <p class="cr-join">{join}</p>}
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
</article>
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.cr-card {
|
|
66
|
+
height: 100%;
|
|
67
|
+
}
|
|
68
|
+
.cr-cover {
|
|
69
|
+
position: relative;
|
|
70
|
+
aspect-ratio: 16 / 9;
|
|
71
|
+
background: color-mix(in srgb, var(--accent) 16%, var(--surface));
|
|
72
|
+
}
|
|
73
|
+
.cr-cover img {
|
|
74
|
+
display: block;
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
object-fit: cover;
|
|
78
|
+
}
|
|
79
|
+
.cr-cover-blank {
|
|
80
|
+
position: absolute;
|
|
81
|
+
inset: 0;
|
|
82
|
+
background:
|
|
83
|
+
radial-gradient(circle at 78% 28%, color-mix(in srgb, var(--accent) 34%, transparent) 0 18%, transparent 19%),
|
|
84
|
+
linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), color-mix(in srgb, var(--ink) 10%, var(--surface)));
|
|
85
|
+
}
|
|
86
|
+
.cr-count {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 0.75rem;
|
|
89
|
+
left: 0.75rem;
|
|
90
|
+
background: var(--surface);
|
|
91
|
+
color: var(--ink);
|
|
92
|
+
box-shadow: 0 1px 2px color-mix(in srgb, var(--shadow-ink, #000) 18%, transparent);
|
|
93
|
+
}
|
|
94
|
+
.cr-body {
|
|
95
|
+
flex: 1;
|
|
96
|
+
}
|
|
97
|
+
.cr-card .cr-title {
|
|
98
|
+
font-size: calc(var(--h3) * 0.92);
|
|
99
|
+
}
|
|
100
|
+
.cr-card .cr-title a:focus-visible {
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
.cr-card:focus-within {
|
|
104
|
+
outline: 3px solid var(--link);
|
|
105
|
+
outline-offset: 3px;
|
|
106
|
+
}
|
|
107
|
+
.cr-status {
|
|
108
|
+
display: grid;
|
|
109
|
+
gap: 0.5rem;
|
|
110
|
+
margin-top: auto;
|
|
111
|
+
padding-top: 0.5rem;
|
|
112
|
+
}
|
|
113
|
+
.cr-status > * {
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
.cr-figures {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-wrap: wrap;
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
gap: 0.25rem 1rem;
|
|
121
|
+
color: var(--muted);
|
|
122
|
+
font-size: var(--text-sm);
|
|
123
|
+
font-variant-numeric: tabular-nums;
|
|
124
|
+
}
|
|
125
|
+
.cr-figures > :first-child {
|
|
126
|
+
color: var(--ink);
|
|
127
|
+
font-weight: 700;
|
|
128
|
+
}
|
|
129
|
+
.cr-state {
|
|
130
|
+
display: inline-flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: 0.375rem;
|
|
133
|
+
}
|
|
134
|
+
.cr-done {
|
|
135
|
+
color: var(--ink);
|
|
136
|
+
font-weight: 700;
|
|
137
|
+
}
|
|
138
|
+
.cr-chip {
|
|
139
|
+
display: inline-flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: 0.375rem;
|
|
142
|
+
padding: 0.1875rem 0.625rem;
|
|
143
|
+
border-radius: var(--pill);
|
|
144
|
+
background: color-mix(in srgb, var(--accent) 14%, transparent);
|
|
145
|
+
color: var(--ink);
|
|
146
|
+
font-size: var(--text-xs);
|
|
147
|
+
font-weight: 700;
|
|
148
|
+
letter-spacing: 0.02em;
|
|
149
|
+
}
|
|
150
|
+
.cr-access > .cr-chip {
|
|
151
|
+
font-size: var(--text-xs);
|
|
152
|
+
}
|
|
153
|
+
.cr-chip-locked {
|
|
154
|
+
background: color-mix(in srgb, var(--ink) 9%, transparent);
|
|
155
|
+
}
|
|
156
|
+
.cr-join {
|
|
157
|
+
color: var(--ink);
|
|
158
|
+
font-size: var(--text-sm);
|
|
159
|
+
}
|
|
160
|
+
/* The list: the cover at the left, the words beside it. */
|
|
161
|
+
.cr-list {
|
|
162
|
+
flex-direction: column;
|
|
163
|
+
}
|
|
164
|
+
@media (min-width: 40rem) {
|
|
165
|
+
.cr-list {
|
|
166
|
+
display: grid;
|
|
167
|
+
grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
|
|
168
|
+
}
|
|
169
|
+
.cr-list .cr-cover {
|
|
170
|
+
aspect-ratio: auto;
|
|
171
|
+
min-height: 100%;
|
|
172
|
+
}
|
|
173
|
+
.cr-list .cr-cover img {
|
|
174
|
+
position: absolute;
|
|
175
|
+
inset: 0;
|
|
176
|
+
}
|
|
177
|
+
.cr-list .cr-status {
|
|
178
|
+
max-width: 28rem;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
// A Classroom's head and its courses, for both layouts (board D1): the
|
|
3
|
+
// kicker and heading the organization typed, then the line under them (with
|
|
4
|
+
// a visitor, "You have finished 1 of 6 courses and have 3 under way."; signed
|
|
5
|
+
// out, why to sign in and the Sign in link), then the cards in the grid or
|
|
6
|
+
// the rows of the list. With no course the heading stands over "Nothing here
|
|
7
|
+
// yet."; with neither, nothing is drawn.
|
|
8
|
+
import type { Section } from '@backgold/content'
|
|
9
|
+
import Band from '../Band.astro'
|
|
10
|
+
import SectionHead from '../SectionHead.astro'
|
|
11
|
+
import CourseCard from './CourseCard.astro'
|
|
12
|
+
import type { Classroom } from './classroom'
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
section: Section
|
|
16
|
+
classroom: Classroom
|
|
17
|
+
layout: 'grid' | 'list'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { section, classroom, layout } = Astro.props
|
|
21
|
+
const { kicker, heading, cards, summary, signIn, visitor } = classroom
|
|
22
|
+
const plural = (n: number) => (n === 1 ? 'course' : 'courses')
|
|
23
|
+
---
|
|
24
|
+
{(heading || cards.length > 0) && (
|
|
25
|
+
<Band section={section} class:list={['classroom', `classroom-${layout}`]}>
|
|
26
|
+
<SectionHead kicker={kicker} heading={heading} more={[]} />
|
|
27
|
+
{summary && (
|
|
28
|
+
<p class="cr-line">
|
|
29
|
+
You have finished <strong>{summary.finished}</strong> of {summary.total} {plural(summary.total)}{summary.started > 0 && <> and have <strong>{summary.started}</strong> under way</>}.
|
|
30
|
+
</p>
|
|
31
|
+
)}
|
|
32
|
+
{signIn && cards.length > 0 && (
|
|
33
|
+
<p class="cr-line">
|
|
34
|
+
Sign in with your email and the Academy keeps your place in every course. <a class="text-link" href={signIn}>Sign in</a>
|
|
35
|
+
</p>
|
|
36
|
+
)}
|
|
37
|
+
{cards.length > 0 ? (
|
|
38
|
+
<ul class:list={['cr-cards', `cr-cards-${layout}`]} role="list">
|
|
39
|
+
{cards.map((card) => (
|
|
40
|
+
<li><CourseCard card={card} signedIn={visitor !== null} orgName={classroom.orgName} level={heading ? 3 : 2} layout={layout} /></li>
|
|
41
|
+
))}
|
|
42
|
+
</ul>
|
|
43
|
+
) : (
|
|
44
|
+
<p class="empty">Nothing here yet.</p>
|
|
45
|
+
)}
|
|
46
|
+
</Band>
|
|
47
|
+
)}
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
/* The line sets as one sentence: wide enough that the signed-out line and
|
|
51
|
+
its Sign in link share a line on a desktop, and where it does wrap, the
|
|
52
|
+
link stays whole and never sits alone on the last line. */
|
|
53
|
+
.cr-line {
|
|
54
|
+
max-width: 46rem;
|
|
55
|
+
margin: -0.75rem 0 1.75rem;
|
|
56
|
+
color: var(--muted);
|
|
57
|
+
text-wrap: pretty;
|
|
58
|
+
}
|
|
59
|
+
.cr-line .text-link {
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
}
|
|
62
|
+
.cr-line strong {
|
|
63
|
+
color: var(--ink);
|
|
64
|
+
}
|
|
65
|
+
.cr-cards {
|
|
66
|
+
display: grid;
|
|
67
|
+
gap: 1.5rem;
|
|
68
|
+
margin: 0;
|
|
69
|
+
padding: 0;
|
|
70
|
+
list-style: none;
|
|
71
|
+
}
|
|
72
|
+
.cr-cards > li {
|
|
73
|
+
min-width: 0;
|
|
74
|
+
}
|
|
75
|
+
@media (min-width: 40rem) {
|
|
76
|
+
.cr-cards-grid {
|
|
77
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@media (min-width: 64rem) {
|
|
81
|
+
.cr-cards-grid {
|
|
82
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
.cr-cards-list {
|
|
86
|
+
gap: 1rem;
|
|
87
|
+
}
|
|
88
|
+
</style>
|