@atelic-action/ui 7.2.0 → 8.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/README.md +439 -132
- package/bin/atelic-check-sentry.ts +5 -0
- package/dist/gate/middleware.js +15 -1
- package/dist/monitoring/server.d.ts +72 -0
- package/dist/monitoring/server.js +201 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/marketing-config.d.ts +28 -1
- package/dist/vite/marketing-config.js +62 -0
- package/package.json +23 -11
- package/src/app/ErrorFallback.tsx +6 -2
- package/src/app/context/AppContext.tsx +10 -1
- package/src/app/index.ts +0 -1
- package/src/app/layout/AppPage.tsx +36 -7
- package/src/app/layout/DesktopRail.tsx +15 -6
- package/src/app/layout/MobileMenu.tsx +14 -5
- package/src/app/layout/MobileTabBar.tsx +3 -2
- package/src/app/layout/PageError.tsx +7 -4
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/SectionCards.tsx +7 -2
- package/src/app/layout/UserMenu.tsx +13 -7
- package/src/app/ui/alert.tsx +42 -12
- package/src/app/ui/badge.tsx +1 -1
- package/src/app/ui/button.tsx +2 -1
- package/src/app/ui/command.tsx +86 -21
- package/src/app/ui/country-dropdown.tsx +26 -47
- package/src/app/ui/form.tsx +48 -9
- package/src/app/ui/pagination.tsx +1 -1
- package/src/app/ui/progress.tsx +26 -12
- package/src/app/ui/search-input.tsx +16 -3
- package/src/app/ui/select.tsx +8 -3
- package/src/app/ui/slider.tsx +62 -15
- package/src/artifact/AppErrorBoundary.tsx +12 -7
- package/src/artifact/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +102 -17
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +361 -0
- package/src/chrome/Footer.tsx +126 -31
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +399 -0
- package/src/chrome/SiteHeader.tsx +268 -23
- package/src/chrome/SiteMenu.tsx +200 -19
- package/src/chrome/SiteShell.tsx +151 -14
- package/src/chrome/StickyCTABar.tsx +60 -2
- package/src/chrome/brandMark.ts +56 -0
- package/src/chrome/icons.ts +58 -0
- package/src/chrome/index.ts +16 -0
- package/src/chrome/navSections.ts +55 -0
- package/src/components/ColumnChart.tsx +27 -2
- package/src/components/DataTable.tsx +104 -85
- package/src/components/Disclosure.tsx +3 -1
- package/src/components/Hint.tsx +3 -24
- package/src/components/NotFound.tsx +7 -3
- package/src/components/StarRating.tsx +45 -19
- package/src/components/ThresholdScale.tsx +36 -26
- package/src/email/atoms.tsx +13 -57
- package/src/email/frame.tsx +4 -6
- package/src/email/index.ts +4 -10
- package/src/email/scoreboard.tsx +107 -186
- package/src/email/text.ts +30 -0
- package/src/email/theme.tsx +76 -9
- package/src/gate/middleware.ts +15 -1
- package/src/hooks/useDismiss.ts +39 -0
- package/src/lib/emailText.tsx +26 -0
- package/src/lib/phoneText.tsx +40 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/monitoring/ErrorCatcherScript.tsx +15 -0
- package/src/monitoring/catcher.ts +118 -0
- package/src/monitoring/index.ts +25 -0
- package/src/monitoring/sdk.ts +112 -0
- package/src/monitoring/server.ts +244 -0
- package/src/monitoring/start.ts +118 -0
- package/src/primitives/Button.tsx +5 -1
- package/src/primitives/Eyebrow.tsx +6 -2
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- package/src/routing/index.ts +1 -0
- package/src/routing/miss.ts +32 -0
- package/src/scripts/check-sentry.ts +77 -0
- package/src/sections/BlogIndex.tsx +17 -3
- package/src/sections/BlogPost.tsx +10 -1
- package/src/sections/CTASection.tsx +2 -2
- package/src/sections/CalloutPanel.tsx +34 -0
- package/src/sections/ComparisonTable.tsx +23 -2
- package/src/sections/ContactForm.tsx +61 -17
- package/src/sections/FAQBrowser.tsx +11 -2
- package/src/sections/FeatureGrid.tsx +6 -2
- package/src/sections/FullBleedVideo.tsx +167 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +70 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +80 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +18 -5
- package/src/sections/LogoMarquee.tsx +43 -11
- package/src/sections/MapEmbed.tsx +13 -9
- package/src/sections/PageHero.tsx +16 -2
- package/src/sections/ProcessSteps.tsx +27 -4
- package/src/sections/ProfileCards.tsx +12 -2
- package/src/sections/ProofStrip.tsx +44 -0
- package/src/sections/RevealSlider.tsx +28 -7
- package/src/sections/ReviewCarousel.tsx +17 -4
- package/src/sections/ReviewWall.tsx +2 -2
- package/src/sections/SplitSection.tsx +2 -1
- package/src/sections/index.ts +15 -6
- package/src/sections/siteConfig.ts +101 -8
- package/src/styles/app.css +33 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +68 -13
- package/src/styles/chrome.css +1134 -56
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +140 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +108 -39
- package/src/styles/sections.css +500 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +220 -3
- package/src/vite/index.ts +4 -0
- package/src/vite/marketing-config.ts +81 -1
- package/src/app/CardErrorBoundary.tsx +0 -39
- package/src/sections/CTABanner.tsx +0 -93
- package/src/sections/DeviceShowcase.tsx +0 -39
- package/src/sections/MediaBand.tsx +0 -20
- package/src/sections/MenuList.tsx +0 -44
- package/src/sections/PressQuotes.tsx +0 -51
- package/src/sections/SocialStrip.tsx +0 -83
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FormEvent, type ReactNode, useState } from "react";
|
|
1
|
+
import { type FormEvent, type ReactNode, useId, useState } from "react";
|
|
2
2
|
import { isHoneypotFilled } from "../lib/honeypot";
|
|
3
3
|
import { trackEvent } from "../lib/trackEvent";
|
|
4
4
|
import { Button } from "../primitives/Button";
|
|
@@ -62,6 +62,21 @@ export function ContactForm({
|
|
|
62
62
|
const withBase = useWithBase();
|
|
63
63
|
const [errors, setErrors] = useState<FieldErrors>({});
|
|
64
64
|
const [status, setStatus] = useState<Status>("idle");
|
|
65
|
+
// Ids from useId, so two forms on one page never share a label's target.
|
|
66
|
+
const uid = useId();
|
|
67
|
+
const ids = {
|
|
68
|
+
name: `${uid}-name`,
|
|
69
|
+
email: `${uid}-email`,
|
|
70
|
+
topic: `${uid}-topic`,
|
|
71
|
+
message: `${uid}-message`,
|
|
72
|
+
company: `${uid}-company`,
|
|
73
|
+
};
|
|
74
|
+
// A refused field says so and why: aria-invalid, and its message as its
|
|
75
|
+
// description, only while it is refused.
|
|
76
|
+
const refused = (field: keyof FieldErrors) =>
|
|
77
|
+
errors[field]
|
|
78
|
+
? { "aria-invalid": true as const, "aria-describedby": `${ids[field]}-error` }
|
|
79
|
+
: {};
|
|
65
80
|
|
|
66
81
|
async function handleSubmit(event: FormEvent<HTMLFormElement>) {
|
|
67
82
|
event.preventDefault();
|
|
@@ -80,8 +95,12 @@ export function ContactForm({
|
|
|
80
95
|
message: !message,
|
|
81
96
|
};
|
|
82
97
|
setErrors(nextErrors);
|
|
83
|
-
|
|
98
|
+
const firstRefused = (["name", "email", "message"] as const).find((field) => nextErrors[field]);
|
|
99
|
+
if (firstRefused) {
|
|
84
100
|
setStatus("idle");
|
|
101
|
+
// Focus goes to the first field to fix, where its message is read.
|
|
102
|
+
const field = form.elements.namedItem(firstRefused);
|
|
103
|
+
if (field instanceof HTMLElement) field.focus();
|
|
85
104
|
return;
|
|
86
105
|
}
|
|
87
106
|
|
|
@@ -119,36 +138,61 @@ export function ContactForm({
|
|
|
119
138
|
|
|
120
139
|
return (
|
|
121
140
|
<form onSubmit={handleSubmit} noValidate>
|
|
122
|
-
{status
|
|
123
|
-
|
|
141
|
+
{/* One shot status: the thanks or the failure is announced once when it
|
|
142
|
+
appears (Component Rules 14). The region is always drawn, so a screen
|
|
143
|
+
reader is already watching it when the words arrive. */}
|
|
144
|
+
<output className="form-status">
|
|
145
|
+
{status === "sent" && <span className="form-success">{successMessage}</span>}
|
|
146
|
+
{status === "failed" && <span className="form-error">{errorMessage}</span>}
|
|
147
|
+
</output>
|
|
124
148
|
<div className={["field", errors.name && "invalid"].filter(Boolean).join(" ")}>
|
|
125
|
-
<label htmlFor=
|
|
126
|
-
<input
|
|
127
|
-
|
|
149
|
+
<label htmlFor={ids.name}>Your name</label>
|
|
150
|
+
<input
|
|
151
|
+
id={ids.name}
|
|
152
|
+
name="name"
|
|
153
|
+
type="text"
|
|
154
|
+
autoComplete="name"
|
|
155
|
+
required
|
|
156
|
+
{...refused("name")}
|
|
157
|
+
/>
|
|
158
|
+
<span className="err" id={`${ids.name}-error`}>
|
|
159
|
+
Please enter your name.
|
|
160
|
+
</span>
|
|
128
161
|
</div>
|
|
129
162
|
<div className={["field", errors.email && "invalid"].filter(Boolean).join(" ")}>
|
|
130
|
-
<label htmlFor=
|
|
131
|
-
<input
|
|
132
|
-
|
|
163
|
+
<label htmlFor={ids.email}>Email</label>
|
|
164
|
+
<input
|
|
165
|
+
id={ids.email}
|
|
166
|
+
name="email"
|
|
167
|
+
type="email"
|
|
168
|
+
autoComplete="email"
|
|
169
|
+
required
|
|
170
|
+
{...refused("email")}
|
|
171
|
+
/>
|
|
172
|
+
<span className="err" id={`${ids.email}-error`}>
|
|
173
|
+
Please enter a valid email.
|
|
174
|
+
</span>
|
|
133
175
|
</div>
|
|
134
176
|
<div className="field">
|
|
135
|
-
<label htmlFor=
|
|
136
|
-
<select id=
|
|
177
|
+
<label htmlFor={ids.topic}>What can we help with?</label>
|
|
178
|
+
<select id={ids.topic} name="topic">
|
|
137
179
|
{topics.map((topic) => (
|
|
138
180
|
<option key={topic}>{topic}</option>
|
|
139
181
|
))}
|
|
140
182
|
</select>
|
|
141
183
|
</div>
|
|
142
184
|
<div className={["field", errors.message && "invalid"].filter(Boolean).join(" ")}>
|
|
143
|
-
<label htmlFor=
|
|
144
|
-
<textarea id=
|
|
145
|
-
<span className="err"
|
|
185
|
+
<label htmlFor={ids.message}>Message</label>
|
|
186
|
+
<textarea id={ids.message} name="message" required {...refused("message")} />
|
|
187
|
+
<span className="err" id={`${ids.message}-error`}>
|
|
188
|
+
Please add a short message.
|
|
189
|
+
</span>
|
|
146
190
|
</div>
|
|
147
191
|
{/* Honeypot: visually hidden and skipped by keyboard/screen readers;
|
|
148
192
|
bots that fill it are quietly dropped by the backend. */}
|
|
149
193
|
<div className="hp-field" aria-hidden="true">
|
|
150
|
-
<label htmlFor=
|
|
151
|
-
<input id=
|
|
194
|
+
<label htmlFor={ids.company}>Company</label>
|
|
195
|
+
<input id={ids.company} name="company" type="text" tabIndex={-1} autoComplete="off" />
|
|
152
196
|
</div>
|
|
153
197
|
<Button type="submit" size="lg" arrow style={{ width: "100%" }}>
|
|
154
198
|
{status === "sending" ? "Sending…" : "Send Message"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Check, ChevronDown, Link2, Search, X } from "lucide-react";
|
|
2
|
-
import { type ReactNode, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { type ReactNode, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { newTabProps } from "../lib/newTabProps";
|
|
4
4
|
import { useOpenHeight } from "../lib/useOpenHeight";
|
|
5
5
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
@@ -157,6 +157,14 @@ export function FAQBrowser({
|
|
|
157
157
|
});
|
|
158
158
|
}, [categories]);
|
|
159
159
|
|
|
160
|
+
// Clearing the search removes the clear button, and the focus it held
|
|
161
|
+
// would fall to the page; it goes back to the field it cleared instead.
|
|
162
|
+
const searchRef = useRef<HTMLInputElement>(null);
|
|
163
|
+
function clearSearch() {
|
|
164
|
+
setQuery("");
|
|
165
|
+
searchRef.current?.focus();
|
|
166
|
+
}
|
|
167
|
+
|
|
160
168
|
function toggle(id: string) {
|
|
161
169
|
setOpenIds((prev) => {
|
|
162
170
|
const next = new Set(prev);
|
|
@@ -195,6 +203,7 @@ export function FAQBrowser({
|
|
|
195
203
|
<div className="faq-search">
|
|
196
204
|
<Search size={18} strokeWidth={1.6} aria-hidden="true" />
|
|
197
205
|
<input
|
|
206
|
+
ref={searchRef}
|
|
198
207
|
type="search"
|
|
199
208
|
value={query}
|
|
200
209
|
onChange={(event) => setQuery(event.target.value)}
|
|
@@ -206,7 +215,7 @@ export function FAQBrowser({
|
|
|
206
215
|
type="button"
|
|
207
216
|
className="faq-search-clear"
|
|
208
217
|
aria-label="Clear search"
|
|
209
|
-
onClick={
|
|
218
|
+
onClick={clearSearch}
|
|
210
219
|
>
|
|
211
220
|
<X size={16} strokeWidth={2} aria-hidden="true" />
|
|
212
221
|
</button>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { SectionHeading } from "../primitives";
|
|
3
3
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
4
|
+
import type { Surface } from "./siteConfig";
|
|
4
5
|
|
|
5
6
|
interface FeatureCardBase {
|
|
6
7
|
/** Small mono index label, e.g. "01". */
|
|
@@ -29,10 +30,12 @@ export interface FeatureGridProps {
|
|
|
29
30
|
/** Deprecated no-op: the eyebrow's trailing fade is now its only rendering. */
|
|
30
31
|
eyebrowRun?: boolean;
|
|
31
32
|
title: ReactNode;
|
|
33
|
+
/** A line or two under the heading, before the cards. */
|
|
34
|
+
lead?: ReactNode;
|
|
32
35
|
items: FeatureCard[];
|
|
33
36
|
/** Cards per row at desktop width (default 4). */
|
|
34
37
|
columns?: 2 | 3 | 4;
|
|
35
|
-
surface?:
|
|
38
|
+
surface?: Surface;
|
|
36
39
|
id?: string;
|
|
37
40
|
}
|
|
38
41
|
|
|
@@ -40,6 +43,7 @@ export interface FeatureGridProps {
|
|
|
40
43
|
export function FeatureGrid({
|
|
41
44
|
eyebrow,
|
|
42
45
|
title,
|
|
46
|
+
lead,
|
|
43
47
|
items,
|
|
44
48
|
columns = 4,
|
|
45
49
|
surface = "alt",
|
|
@@ -51,7 +55,7 @@ export function FeatureGrid({
|
|
|
51
55
|
return (
|
|
52
56
|
<section className={sectionClasses} id={id}>
|
|
53
57
|
<div className="wrap">
|
|
54
|
-
<SectionHeading eyebrow={eyebrow} title={title} />
|
|
58
|
+
<SectionHeading eyebrow={eyebrow} title={title} lead={lead} />
|
|
55
59
|
<div className="feature-grid" style={gridStyle}>
|
|
56
60
|
{items.map((item) => {
|
|
57
61
|
const inner = (
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { Pause, Play } from "lucide-react";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useWithBase } from "../routing/BasePathProvider";
|
|
4
|
+
|
|
5
|
+
export interface FullBleedVideoProps {
|
|
6
|
+
/** The video file, e.g. "/video/crew.mp4". */
|
|
7
|
+
src: string;
|
|
8
|
+
/** Its MIME type, when the file's extension does not say it. */
|
|
9
|
+
type?: string;
|
|
10
|
+
/** The video's first frame as a picture, shown at once and kept for reduced motion. */
|
|
11
|
+
poster?: string;
|
|
12
|
+
/** What the video shows, for a screen reader. Site copy, so it always comes in as a prop. */
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* A shot brief rendered as a labeled block until the first frame exists.
|
|
16
|
+
* Given without a `poster`, it says the footage does not exist yet, so the
|
|
17
|
+
* band draws the brief alone and never requests `src`.
|
|
18
|
+
*/
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** The band's height, any CSS length. Defaults to clamp(260px, 42vw, 560px). */
|
|
21
|
+
height?: string;
|
|
22
|
+
/** Shows a pause and play button over the band's corner. Off by default. */
|
|
23
|
+
controls?: boolean;
|
|
24
|
+
/** The button's names while playing and while paused. */
|
|
25
|
+
pauseLabel?: string;
|
|
26
|
+
playLabel?: string;
|
|
27
|
+
id?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A silent, looping video band that runs edge to edge. The poster (the
|
|
32
|
+
* first frame) shows at once as a plain picture, so the page never waits on
|
|
33
|
+
* the video. The video element, and with it the clip's download, arrives
|
|
34
|
+
* only once the band comes within a screen's height of the viewport,
|
|
35
|
+
* wherever on the page it sits; it then starts as soon as it is on screen
|
|
36
|
+
* (an iPhone buffers nothing until play is asked for), fading in over the
|
|
37
|
+
* picture, and plays only while it is on screen.
|
|
38
|
+
* Under `prefers-reduced-motion` it never loads and stays on the poster.
|
|
39
|
+
* Muted, looping, and inline, with no controls unless asked for.
|
|
40
|
+
*/
|
|
41
|
+
export function FullBleedVideo({
|
|
42
|
+
src,
|
|
43
|
+
type,
|
|
44
|
+
poster,
|
|
45
|
+
label,
|
|
46
|
+
placeholder,
|
|
47
|
+
height = "clamp(260px, 42vw, 560px)",
|
|
48
|
+
controls = false,
|
|
49
|
+
pauseLabel = "Pause the video",
|
|
50
|
+
playLabel = "Play the video",
|
|
51
|
+
id,
|
|
52
|
+
}: FullBleedVideoProps) {
|
|
53
|
+
const withBase = useWithBase();
|
|
54
|
+
const ref = useRef<HTMLVideoElement>(null);
|
|
55
|
+
const bandRef = useRef<HTMLElement>(null);
|
|
56
|
+
// Off until the effect has asked the reader's device: a reduced motion
|
|
57
|
+
// reader never gets the video's source at all.
|
|
58
|
+
const [load, setLoad] = useState(false);
|
|
59
|
+
// Whether the band has come near the viewport, which is when the clip is
|
|
60
|
+
// fetched. Once near, the video stays, so scrolling back never fetches again.
|
|
61
|
+
const [near, setNear] = useState(false);
|
|
62
|
+
const [visible, setVisible] = useState(false);
|
|
63
|
+
const [playing, setPlaying] = useState(false);
|
|
64
|
+
// A pause the reader asked for holds until they ask to play again.
|
|
65
|
+
const [held, setHeld] = useState(false);
|
|
66
|
+
|
|
67
|
+
// A brief with no first frame is a band whose footage is not shot yet:
|
|
68
|
+
// there is no clip to fetch, so the video never mounts.
|
|
69
|
+
const footage = src !== "" && (poster !== undefined || placeholder === undefined);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!footage) return;
|
|
73
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
|
|
74
|
+
setLoad(true);
|
|
75
|
+
}, [footage]);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const band = bandRef.current;
|
|
79
|
+
if (!load || !band) return;
|
|
80
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
81
|
+
setNear(true);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const observer = new IntersectionObserver(
|
|
85
|
+
(entries) => {
|
|
86
|
+
if (!entries.some((entry) => entry.isIntersecting)) return;
|
|
87
|
+
setNear(true);
|
|
88
|
+
observer.disconnect();
|
|
89
|
+
},
|
|
90
|
+
{ rootMargin: "100% 0px" },
|
|
91
|
+
);
|
|
92
|
+
observer.observe(band);
|
|
93
|
+
return () => observer.disconnect();
|
|
94
|
+
}, [load]);
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const video = ref.current;
|
|
98
|
+
if (!load || !near || !video) return;
|
|
99
|
+
// React sets muted as a property and never renders the attribute, and an
|
|
100
|
+
// iPhone browser's autoplay check reads the attribute, so set both.
|
|
101
|
+
video.muted = true;
|
|
102
|
+
video.setAttribute("muted", "");
|
|
103
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
104
|
+
setVisible(true);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const observer = new IntersectionObserver(
|
|
108
|
+
(entries) => setVisible(entries[entries.length - 1]?.isIntersecting ?? false),
|
|
109
|
+
{ rootMargin: "120px 0px" },
|
|
110
|
+
);
|
|
111
|
+
observer.observe(video);
|
|
112
|
+
return () => observer.disconnect();
|
|
113
|
+
}, [load, near]);
|
|
114
|
+
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
const video = ref.current;
|
|
117
|
+
if (!video) return;
|
|
118
|
+
if (visible && !held) {
|
|
119
|
+
video.play()?.catch((err: unknown) => {
|
|
120
|
+
// A pause that interrupts a pending play is the reader scrolling past.
|
|
121
|
+
if ((err as { name?: string } | null)?.name === "AbortError") return;
|
|
122
|
+
// Autoplay refused: the poster stays, which is the reduced motion look.
|
|
123
|
+
setHeld(true);
|
|
124
|
+
});
|
|
125
|
+
} else if (!video.paused) {
|
|
126
|
+
video.pause();
|
|
127
|
+
}
|
|
128
|
+
}, [visible, held]);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<section ref={bandRef} className="fbv" id={id} style={{ height }}>
|
|
132
|
+
{poster ? (
|
|
133
|
+
<img className="fbv-poster" src={withBase(poster)} alt={label} decoding="async" />
|
|
134
|
+
) : (
|
|
135
|
+
<div className="fbv-poster ph" role="img" aria-label={label}>
|
|
136
|
+
{placeholder ?? label}
|
|
137
|
+
</div>
|
|
138
|
+
)}
|
|
139
|
+
{footage && load && near && (
|
|
140
|
+
<video
|
|
141
|
+
ref={ref}
|
|
142
|
+
className={["fbv-video", playing && "is-on"].filter(Boolean).join(" ")}
|
|
143
|
+
aria-hidden="true"
|
|
144
|
+
tabIndex={-1}
|
|
145
|
+
muted
|
|
146
|
+
loop
|
|
147
|
+
playsInline
|
|
148
|
+
preload="auto"
|
|
149
|
+
onPlaying={() => setPlaying(true)}
|
|
150
|
+
onPause={() => setPlaying(false)}
|
|
151
|
+
>
|
|
152
|
+
<source src={withBase(src)} type={type} />
|
|
153
|
+
</video>
|
|
154
|
+
)}
|
|
155
|
+
{controls && footage && load && near && (
|
|
156
|
+
<button
|
|
157
|
+
type="button"
|
|
158
|
+
className="fbv-toggle"
|
|
159
|
+
aria-label={playing ? pauseLabel : playLabel}
|
|
160
|
+
onClick={() => setHeld(playing)}
|
|
161
|
+
>
|
|
162
|
+
{playing ? <Pause size={20} aria-hidden="true" /> : <Play size={20} aria-hidden="true" />}
|
|
163
|
+
</button>
|
|
164
|
+
)}
|
|
165
|
+
</section>
|
|
166
|
+
);
|
|
167
|
+
}
|
package/src/sections/Gallery.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Eyebrow, Lead } from "../primitives";
|
|
3
3
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
4
|
+
import type { Surface } from "./siteConfig";
|
|
4
5
|
|
|
5
6
|
export interface GalleryPhoto {
|
|
6
7
|
src?: string;
|
|
@@ -20,7 +21,7 @@ export interface GalleryProps {
|
|
|
20
21
|
photos: GalleryPhoto[];
|
|
21
22
|
/** Tiles per row at desktop width (default 3). */
|
|
22
23
|
columns?: 2 | 3;
|
|
23
|
-
surface?:
|
|
24
|
+
surface?: Surface;
|
|
24
25
|
/** Small note under the grid, e.g. photo provenance. */
|
|
25
26
|
footnote?: ReactNode;
|
|
26
27
|
}
|
|
@@ -55,10 +56,11 @@ export function Gallery({
|
|
|
55
56
|
<div className="wrap">
|
|
56
57
|
{eyebrow && <Eyebrow>{eyebrow}</Eyebrow>}
|
|
57
58
|
<h2>{title}</h2>
|
|
58
|
-
{lead && <Lead
|
|
59
|
+
{lead && <Lead>{lead}</Lead>}
|
|
59
60
|
<ul className={`gallery-grid cols-${columns}`}>
|
|
60
|
-
{photos.map((photo) => (
|
|
61
|
-
|
|
61
|
+
{photos.map((photo, index) => (
|
|
62
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two tiles may show one photo or share a brief, and a tile may have neither; the place keeps every key defined and unique, and the tiles never reorder
|
|
63
|
+
<li className="gallery-item" key={`${index} ${photo.src ?? photo.placeholder ?? ""}`}>
|
|
62
64
|
<figure>
|
|
63
65
|
{photo.src ? (
|
|
64
66
|
<div className="gallery-frame">
|
package/src/sections/Hero.tsx
CHANGED
|
@@ -16,6 +16,8 @@ export interface HeroTrustItem {
|
|
|
16
16
|
|
|
17
17
|
export interface HeroProps {
|
|
18
18
|
eyebrow?: string;
|
|
19
|
+
/** Draws the eyebrow's trailing rule. Defaults to true; false sets the kicker alone. */
|
|
20
|
+
eyebrowRule?: boolean;
|
|
19
21
|
/** Headline; use <em className="serif"> spans for the serif accent. */
|
|
20
22
|
title: ReactNode;
|
|
21
23
|
subtitle?: ReactNode;
|
|
@@ -36,11 +38,19 @@ export interface HeroProps {
|
|
|
36
38
|
trust?: HeroTrustItem[];
|
|
37
39
|
/** Anchor target for the scroll-down affordance, e.g. "#pain". */
|
|
38
40
|
scrollTarget?: string;
|
|
41
|
+
/**
|
|
42
|
+
* `overlay`, the default, sets the copy over a full bleed photo a screen
|
|
43
|
+
* tall. `split` sets the copy and its actions on the primary field on one
|
|
44
|
+
* side and the photo on the other, at the height the copy needs, stacking
|
|
45
|
+
* with the photo first on a phone; the scroll cue is left out.
|
|
46
|
+
*/
|
|
47
|
+
layout?: "overlay" | "split";
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
/** Full-bleed image hero with scrim, headline, CTA pair, and trust stats. */
|
|
42
51
|
export function Hero({
|
|
43
52
|
eyebrow,
|
|
53
|
+
eyebrowRule = true,
|
|
44
54
|
title,
|
|
45
55
|
subtitle,
|
|
46
56
|
image,
|
|
@@ -48,6 +58,7 @@ export function Hero({
|
|
|
48
58
|
secondaryCTA,
|
|
49
59
|
trust,
|
|
50
60
|
scrollTarget,
|
|
61
|
+
layout = "overlay",
|
|
51
62
|
}: HeroProps) {
|
|
52
63
|
const withBase = useWithBase();
|
|
53
64
|
const ctaProps = (cta: HeroCTA, extra: Partial<ButtonProps>) => ({
|
|
@@ -56,50 +67,70 @@ export function Hero({
|
|
|
56
67
|
...extra,
|
|
57
68
|
});
|
|
58
69
|
|
|
70
|
+
const copy = (
|
|
71
|
+
<>
|
|
72
|
+
{eyebrow && (
|
|
73
|
+
<Eyebrow onDark rule={eyebrowRule}>
|
|
74
|
+
{eyebrow}
|
|
75
|
+
</Eyebrow>
|
|
76
|
+
)}
|
|
77
|
+
<h1>{title}</h1>
|
|
78
|
+
{subtitle && <p className="hero-sub">{subtitle}</p>}
|
|
79
|
+
{(primaryCTA || secondaryCTA) && (
|
|
80
|
+
<div className="cta-row">
|
|
81
|
+
{primaryCTA && (
|
|
82
|
+
<Button {...ctaProps(primaryCTA, { size: "lg", arrow: true })}>
|
|
83
|
+
{primaryCTA.label}
|
|
84
|
+
</Button>
|
|
85
|
+
)}
|
|
86
|
+
{secondaryCTA && (
|
|
87
|
+
<Button {...ctaProps(secondaryCTA, { variant: "ghost", size: "lg", onDark: true })}>
|
|
88
|
+
{secondaryCTA.label}
|
|
89
|
+
</Button>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
{trust && trust.length > 0 && (
|
|
94
|
+
<ul className="hero-trust">
|
|
95
|
+
{trust.map((item) => (
|
|
96
|
+
<li key={item.label}>
|
|
97
|
+
<strong>{item.value}</strong>
|
|
98
|
+
<span>{item.label}</span>
|
|
99
|
+
</li>
|
|
100
|
+
))}
|
|
101
|
+
</ul>
|
|
102
|
+
)}
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
const media = image ? (
|
|
106
|
+
<img
|
|
107
|
+
src={withBase(image.src)}
|
|
108
|
+
alt={image.alt}
|
|
109
|
+
fetchPriority="high"
|
|
110
|
+
{...(image.position ? { style: { objectPosition: image.position } } : {})}
|
|
111
|
+
/>
|
|
112
|
+
) : (
|
|
113
|
+
<div className="hero-media-fallback" />
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (layout === "split") {
|
|
117
|
+
return (
|
|
118
|
+
<section className="hero is-split">
|
|
119
|
+
<div className="hero-split-copy on-primary">
|
|
120
|
+
<div className="hero-split-inner">{copy}</div>
|
|
121
|
+
</div>
|
|
122
|
+
<div className="hero-split-media">{media}</div>
|
|
123
|
+
</section>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
59
127
|
return (
|
|
60
128
|
<section className="hero">
|
|
61
129
|
<div className="hero-media">
|
|
62
|
-
{
|
|
63
|
-
<img
|
|
64
|
-
src={withBase(image.src)}
|
|
65
|
-
alt={image.alt}
|
|
66
|
-
fetchPriority="high"
|
|
67
|
-
{...(image.position ? { style: { objectPosition: image.position } } : {})}
|
|
68
|
-
/>
|
|
69
|
-
) : (
|
|
70
|
-
<div className="hero-media-fallback" />
|
|
71
|
-
)}
|
|
130
|
+
{media}
|
|
72
131
|
<div className="hero-scrim" />
|
|
73
132
|
</div>
|
|
74
|
-
<div className="wrap hero-content">
|
|
75
|
-
{eyebrow && <Eyebrow onDark>{eyebrow}</Eyebrow>}
|
|
76
|
-
<h1>{title}</h1>
|
|
77
|
-
{subtitle && <p className="hero-sub">{subtitle}</p>}
|
|
78
|
-
{(primaryCTA || secondaryCTA) && (
|
|
79
|
-
<div className="cta-row">
|
|
80
|
-
{primaryCTA && (
|
|
81
|
-
<Button {...ctaProps(primaryCTA, { size: "lg", arrow: true })}>
|
|
82
|
-
{primaryCTA.label}
|
|
83
|
-
</Button>
|
|
84
|
-
)}
|
|
85
|
-
{secondaryCTA && (
|
|
86
|
-
<Button {...ctaProps(secondaryCTA, { variant: "ghost", size: "lg", onDark: true })}>
|
|
87
|
-
{secondaryCTA.label}
|
|
88
|
-
</Button>
|
|
89
|
-
)}
|
|
90
|
-
</div>
|
|
91
|
-
)}
|
|
92
|
-
{trust && trust.length > 0 && (
|
|
93
|
-
<ul className="hero-trust">
|
|
94
|
-
{trust.map((item) => (
|
|
95
|
-
<li key={item.label}>
|
|
96
|
-
<strong>{item.value}</strong>
|
|
97
|
-
<span>{item.label}</span>
|
|
98
|
-
</li>
|
|
99
|
-
))}
|
|
100
|
-
</ul>
|
|
101
|
-
)}
|
|
102
|
-
</div>
|
|
133
|
+
<div className="wrap hero-content">{copy}</div>
|
|
103
134
|
{scrollTarget && (
|
|
104
135
|
<a className="hero-scroll" href={withBase(scrollTarget)} aria-label="Scroll down">
|
|
105
136
|
↓
|
|
@@ -17,6 +17,10 @@ export interface JumpRailProps {
|
|
|
17
17
|
export function JumpRail({ items, ariaLabel = "Page sections" }: JumpRailProps) {
|
|
18
18
|
const activeId = useScrollSpy(items.map((item) => item.id));
|
|
19
19
|
|
|
20
|
+
// With every stop filtered away (a search with no match) there is nowhere
|
|
21
|
+
// to jump, so no navigation landmark is drawn empty.
|
|
22
|
+
if (items.length === 0) return null;
|
|
23
|
+
|
|
20
24
|
return (
|
|
21
25
|
<nav className="jump-rail" aria-label={ariaLabel}>
|
|
22
26
|
<div className="wrap jump-rail-inner">
|
|
@@ -25,6 +29,9 @@ export function JumpRail({ items, ariaLabel = "Page sections" }: JumpRailProps)
|
|
|
25
29
|
key={item.id}
|
|
26
30
|
href={`#${item.id}`}
|
|
27
31
|
className={activeId === item.id ? "active" : undefined}
|
|
32
|
+
// The marked tab is told apart by more than its color and underline:
|
|
33
|
+
// a screen reader hears where on the page the reader is.
|
|
34
|
+
aria-current={activeId === item.id ? "location" : undefined}
|
|
28
35
|
>
|
|
29
36
|
{item.label}
|
|
30
37
|
</a>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ProseBlock, ProseBlocks } from "../primitives/ProseBlocks";
|
|
2
|
+
import type { Surface } from "./siteConfig";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Legal documents are prose blocks like any other ported document, so the
|
|
@@ -20,6 +21,8 @@ export interface LegalPageProps {
|
|
|
20
21
|
doc: LegalDoc;
|
|
21
22
|
id?: string;
|
|
22
23
|
className?: string;
|
|
24
|
+
/** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
|
|
25
|
+
surface?: Surface;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
/**
|
|
@@ -31,9 +34,14 @@ export interface LegalPageProps {
|
|
|
31
34
|
* uses capitals to make a clause conspicuous, which carries actual legal
|
|
32
35
|
* weight in some jurisdictions, so it is never normalised away here.
|
|
33
36
|
*/
|
|
34
|
-
export function LegalPage({ doc, id, className }: LegalPageProps) {
|
|
37
|
+
export function LegalPage({ doc, id, className, surface = "default" }: LegalPageProps) {
|
|
35
38
|
return (
|
|
36
|
-
<section
|
|
39
|
+
<section
|
|
40
|
+
className={["section", "legal", surface === "alt" && "surface-alt", className]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(" ")}
|
|
43
|
+
id={id}
|
|
44
|
+
>
|
|
37
45
|
<div className="wrap">
|
|
38
46
|
{doc.lastUpdated && <p className="legal-updated">Last updated: {doc.lastUpdated}</p>}
|
|
39
47
|
<ProseBlocks blocks={doc.blocks} />
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { newTabProps } from "../lib/newTabProps";
|
|
3
|
+
import { useWithBase } from "../routing/BasePathProvider";
|
|
4
|
+
|
|
5
|
+
/** One link in a column, with a figure set right aligned on its line when it has one. */
|
|
6
|
+
export interface LinkColumnLink {
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The row's page. Left out, the row is plain words (its name and its
|
|
10
|
+
* count) with no link, for a page that does not exist yet.
|
|
11
|
+
*/
|
|
12
|
+
href?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A figure the row carries, e.g. a city's count of finished jobs. It sits
|
|
15
|
+
* right aligned on the label's line in tabular numerals, so a column of
|
|
16
|
+
* counts lines up digit under digit.
|
|
17
|
+
*/
|
|
18
|
+
count?: ReactNode;
|
|
19
|
+
/** Opens in a new tab, except on mailto, tel, and sms links. */
|
|
20
|
+
external?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A column: a heading, itself a link when it has an `href`, over its links. */
|
|
24
|
+
export interface LinkColumn {
|
|
25
|
+
heading: string;
|
|
26
|
+
href?: string;
|
|
27
|
+
links: LinkColumnLink[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface LinkColumnsProps {
|
|
31
|
+
columns: LinkColumn[];
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Columns of links under a section's heading, each column a heading over
|
|
37
|
+
* its links, as many across as fit: a site's service areas by region, or a
|
|
38
|
+
* hub page's children. A link can carry a figure on its own line, right
|
|
39
|
+
* aligned, so a list of cities reads with their counts in one column. A
|
|
40
|
+
* row with no `href` is words alone. The least a column narrows to is
|
|
41
|
+
* `--link-columns-min` (170px), so a theme can fit two across a phone.
|
|
42
|
+
*/
|
|
43
|
+
export function LinkColumns({ columns, className }: LinkColumnsProps) {
|
|
44
|
+
const withBase = useWithBase();
|
|
45
|
+
return (
|
|
46
|
+
<div className={["link-columns", className].filter(Boolean).join(" ")}>
|
|
47
|
+
{columns.map((column, place) => (
|
|
48
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two columns may share a heading, so the place keeps the key unique; columns never reorder
|
|
49
|
+
<div className="lc-col" key={`${place} ${column.heading}`}>
|
|
50
|
+
<h3 className="lc-head">
|
|
51
|
+
{column.href ? <a href={withBase(column.href)}>{column.heading}</a> : column.heading}
|
|
52
|
+
</h3>
|
|
53
|
+
<ul>
|
|
54
|
+
{column.links.map((link, at) => (
|
|
55
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a column may link one page twice, so the place keeps the key unique; links never reorder
|
|
56
|
+
<li key={`${at} ${link.href ?? ""}`}>
|
|
57
|
+
{link.href ? (
|
|
58
|
+
<a
|
|
59
|
+
className="lc-link"
|
|
60
|
+
href={withBase(link.href)}
|
|
61
|
+
{...newTabProps(link.href, link.external)}
|
|
62
|
+
>
|
|
63
|
+
<span className="lc-label">{link.label}</span>
|
|
64
|
+
{link.count != null && <span className="lc-count">{link.count}</span>}
|
|
65
|
+
</a>
|
|
66
|
+
) : (
|
|
67
|
+
// No page yet: the name and its count as words, nothing to follow.
|
|
68
|
+
<span className="lc-link">
|
|
69
|
+
<span className="lc-label">{link.label}</span>
|
|
70
|
+
{link.count != null && <span className="lc-count">{link.count}</span>}
|
|
71
|
+
</span>
|
|
72
|
+
)}
|
|
73
|
+
</li>
|
|
74
|
+
))}
|
|
75
|
+
</ul>
|
|
76
|
+
</div>
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|