|
| 1 | +--- |
| 2 | +import { markdown } from "@astropub/md"; |
| 3 | +
|
| 4 | +import { ActivityLocation } from "~/data/schedule"; |
| 5 | +
|
| 6 | +import Heading from "./Heading.astro"; |
| 7 | +import Arrow from "./Arrow.astro"; |
| 8 | +
|
| 9 | +interface Props { |
| 10 | + at?: string; |
| 11 | + description?: string[]; |
| 12 | + id?: string; |
| 13 | + location?: ActivityLocation; |
| 14 | + class?: string; |
| 15 | + level?: "h3" | "h4"; |
| 16 | + title: string; |
| 17 | +} |
| 18 | +
|
| 19 | +const { |
| 20 | + at, |
| 21 | + class: className, |
| 22 | + description = [], |
| 23 | + id, |
| 24 | + location, |
| 25 | + level = "h3", |
| 26 | + title, |
| 27 | + ...rest |
| 28 | +} = Astro.props; |
| 29 | +
|
| 30 | +const descriptionLines = await Promise.all( |
| 31 | + description.map(async (p) => await markdown(p)), |
| 32 | +); |
| 33 | +--- |
| 34 | + |
| 35 | +<div |
| 36 | + class:list={["scheduled-activity", "scheduled-activity-h3", className]} |
| 37 | + id={id} |
| 38 | + {...rest} |
| 39 | +> |
| 40 | + <Heading level={level} class="activity-title"> |
| 41 | + {title} |
| 42 | + </Heading> |
| 43 | + <div class="activity-locators"> |
| 44 | + <div class="activity-time">{at ?? "Time TBA"}</div> |
| 45 | + { |
| 46 | + location && ( |
| 47 | + <a class="activity-location" href={location.href}> |
| 48 | + {location.text} |
| 49 | + </a> |
| 50 | + ) |
| 51 | + } |
| 52 | + </div> |
| 53 | + { |
| 54 | + descriptionLines && ( |
| 55 | + <div class="activity-description">{descriptionLines}</div> |
| 56 | + ) |
| 57 | + } |
| 58 | +</div> |
| 59 | + |
| 60 | +<style> |
| 61 | + .scheduled-activity { |
| 62 | + font-weight: var(--fontWeightLight); |
| 63 | + margin: 0 var(--widthBodyPadding); |
| 64 | + max-width: var(--widthBodyLean); |
| 65 | + scroll-margin-top: 2rem; |
| 66 | + } |
| 67 | + |
| 68 | + .scheduled-activity-h3 { |
| 69 | + margin-top: 2rem; |
| 70 | + } |
| 71 | + |
| 72 | + .activity-title { |
| 73 | + font-family: var(--fontFamilyLogo); |
| 74 | + font-size: var(--fontSizeMedium); |
| 75 | + font-weight: var(--fontWeightLogo); |
| 76 | + text-decoration: none; |
| 77 | + } |
| 78 | + |
| 79 | + .activity-title-inner { |
| 80 | + display: inline; |
| 81 | + } |
| 82 | + |
| 83 | + .activity-locators { |
| 84 | + display: flex; |
| 85 | + font-family: var(--fontFamilyLogo); |
| 86 | + font-weight: var(--fontWeightSemibold); |
| 87 | + gap: 0.75rem; |
| 88 | + justify-content: space-between; |
| 89 | + margin: 0.5rem 0; |
| 90 | + } |
| 91 | + |
| 92 | + .activity-time { |
| 93 | + font-size: var(--fontSizeMedium); |
| 94 | + } |
| 95 | + |
| 96 | + .activity-location { |
| 97 | + line-height: 1.25; |
| 98 | + text-align: right; |
| 99 | + } |
| 100 | + |
| 101 | + .activity-description { |
| 102 | + display: flex; |
| 103 | + gap: 0.5rem; |
| 104 | + flex-direction: column; |
| 105 | + width: 100%; |
| 106 | + } |
| 107 | + |
| 108 | + .activity-within { |
| 109 | + list-style: none; |
| 110 | + padding-left: 0; |
| 111 | + } |
| 112 | + |
| 113 | + @media (min-width: 490px) { |
| 114 | + .scheduled-activity { |
| 115 | + display: grid; |
| 116 | + grid-template-columns: clamp(5rem, 20vw, 10rem) auto; |
| 117 | + grid-template-rows: auto auto auto; |
| 118 | + gap: 0.75rem 1rem; |
| 119 | + } |
| 120 | + |
| 121 | + .activity-title { |
| 122 | + grid-area: 1 / 2 / 2 / 3; |
| 123 | + } |
| 124 | + |
| 125 | + .activity-locators { |
| 126 | + grid-area: 1 / 1 / 3 / 2; |
| 127 | + flex-direction: column; |
| 128 | + margin: 0; |
| 129 | + justify-content: flex-start; |
| 130 | + text-align: right; |
| 131 | + } |
| 132 | + |
| 133 | + .activity-description { |
| 134 | + grid-area: 2 / 2 / 3 / 3; |
| 135 | + } |
| 136 | + |
| 137 | + .activity-within { |
| 138 | + grid-area: 3 / 1 / 4 / 3; |
| 139 | + } |
| 140 | + } |
| 141 | +</style> |
0 commit comments