@atelic-action/ui 7.2.0 → 8.0.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 +312 -126
- package/package.json +14 -10
- 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 +9 -2
- package/src/app/layout/MobileMenu.tsx +5 -1
- package/src/app/layout/PageError.tsx +6 -3
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/UserMenu.tsx +12 -6
- package/src/app/ui/alert.tsx +41 -11
- 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 +46 -7
- 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/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +71 -16
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +329 -0
- package/src/chrome/Footer.tsx +32 -9
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +388 -0
- package/src/chrome/SiteHeader.tsx +235 -18
- package/src/chrome/SiteMenu.tsx +197 -19
- package/src/chrome/SiteShell.tsx +130 -13
- package/src/chrome/StickyCTABar.tsx +56 -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 +4 -1
- 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/hooks/useDismiss.ts +39 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/primitives/Button.tsx +2 -0
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- 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 +158 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +63 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +64 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +17 -4
- 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 +66 -3
- package/src/styles/app.css +24 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +42 -13
- package/src/styles/chrome.css +935 -47
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +137 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +97 -35
- package/src/styles/sections.css +477 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +212 -2
- 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
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
/** A shot brief rendered as a labeled block until the first frame exists. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** The band's height, any CSS length. Defaults to clamp(260px, 42vw, 560px). */
|
|
17
|
+
height?: string;
|
|
18
|
+
/** Shows a pause and play button over the band's corner. Off by default. */
|
|
19
|
+
controls?: boolean;
|
|
20
|
+
/** The button's names while playing and while paused. */
|
|
21
|
+
pauseLabel?: string;
|
|
22
|
+
playLabel?: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A silent, looping video band that runs edge to edge. The poster (the
|
|
28
|
+
* first frame) shows at once as a plain picture, so the page never waits on
|
|
29
|
+
* the video. The video element, and with it the clip's download, arrives
|
|
30
|
+
* only once the band comes within a screen's height of the viewport,
|
|
31
|
+
* wherever on the page it sits; it then starts as soon as it is on screen
|
|
32
|
+
* (an iPhone buffers nothing until play is asked for), fading in over the
|
|
33
|
+
* picture, and plays only while it is on screen.
|
|
34
|
+
* Under `prefers-reduced-motion` it never loads and stays on the poster.
|
|
35
|
+
* Muted, looping, and inline, with no controls unless asked for.
|
|
36
|
+
*/
|
|
37
|
+
export function FullBleedVideo({
|
|
38
|
+
src,
|
|
39
|
+
type,
|
|
40
|
+
poster,
|
|
41
|
+
label,
|
|
42
|
+
placeholder,
|
|
43
|
+
height = "clamp(260px, 42vw, 560px)",
|
|
44
|
+
controls = false,
|
|
45
|
+
pauseLabel = "Pause the video",
|
|
46
|
+
playLabel = "Play the video",
|
|
47
|
+
id,
|
|
48
|
+
}: FullBleedVideoProps) {
|
|
49
|
+
const withBase = useWithBase();
|
|
50
|
+
const ref = useRef<HTMLVideoElement>(null);
|
|
51
|
+
const bandRef = useRef<HTMLElement>(null);
|
|
52
|
+
// Off until the effect has asked the reader's device: a reduced motion
|
|
53
|
+
// reader never gets the video's source at all.
|
|
54
|
+
const [load, setLoad] = useState(false);
|
|
55
|
+
// Whether the band has come near the viewport, which is when the clip is
|
|
56
|
+
// fetched. Once near, the video stays, so scrolling back never fetches again.
|
|
57
|
+
const [near, setNear] = useState(false);
|
|
58
|
+
const [visible, setVisible] = useState(false);
|
|
59
|
+
const [playing, setPlaying] = useState(false);
|
|
60
|
+
// A pause the reader asked for holds until they ask to play again.
|
|
61
|
+
const [held, setHeld] = useState(false);
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
|
|
65
|
+
setLoad(true);
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const band = bandRef.current;
|
|
70
|
+
if (!load || !band) return;
|
|
71
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
72
|
+
setNear(true);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const observer = new IntersectionObserver(
|
|
76
|
+
(entries) => {
|
|
77
|
+
if (!entries.some((entry) => entry.isIntersecting)) return;
|
|
78
|
+
setNear(true);
|
|
79
|
+
observer.disconnect();
|
|
80
|
+
},
|
|
81
|
+
{ rootMargin: "100% 0px" },
|
|
82
|
+
);
|
|
83
|
+
observer.observe(band);
|
|
84
|
+
return () => observer.disconnect();
|
|
85
|
+
}, [load]);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const video = ref.current;
|
|
89
|
+
if (!load || !near || !video) return;
|
|
90
|
+
// React sets muted as a property and never renders the attribute, and an
|
|
91
|
+
// iPhone browser's autoplay check reads the attribute, so set both.
|
|
92
|
+
video.muted = true;
|
|
93
|
+
video.setAttribute("muted", "");
|
|
94
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
95
|
+
setVisible(true);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const observer = new IntersectionObserver(
|
|
99
|
+
(entries) => setVisible(entries[entries.length - 1]?.isIntersecting ?? false),
|
|
100
|
+
{ rootMargin: "120px 0px" },
|
|
101
|
+
);
|
|
102
|
+
observer.observe(video);
|
|
103
|
+
return () => observer.disconnect();
|
|
104
|
+
}, [load, near]);
|
|
105
|
+
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
const video = ref.current;
|
|
108
|
+
if (!video) return;
|
|
109
|
+
if (visible && !held) {
|
|
110
|
+
video.play()?.catch((err: unknown) => {
|
|
111
|
+
// A pause that interrupts a pending play is the reader scrolling past.
|
|
112
|
+
if ((err as { name?: string } | null)?.name === "AbortError") return;
|
|
113
|
+
// Autoplay refused: the poster stays, which is the reduced motion look.
|
|
114
|
+
setHeld(true);
|
|
115
|
+
});
|
|
116
|
+
} else if (!video.paused) {
|
|
117
|
+
video.pause();
|
|
118
|
+
}
|
|
119
|
+
}, [visible, held]);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<section ref={bandRef} className="fbv" id={id} style={{ height }}>
|
|
123
|
+
{poster ? (
|
|
124
|
+
<img className="fbv-poster" src={withBase(poster)} alt={label} decoding="async" />
|
|
125
|
+
) : (
|
|
126
|
+
<div className="fbv-poster ph" role="img" aria-label={label}>
|
|
127
|
+
{placeholder ?? label}
|
|
128
|
+
</div>
|
|
129
|
+
)}
|
|
130
|
+
{load && near && (
|
|
131
|
+
<video
|
|
132
|
+
ref={ref}
|
|
133
|
+
className={["fbv-video", playing && "is-on"].filter(Boolean).join(" ")}
|
|
134
|
+
aria-hidden="true"
|
|
135
|
+
tabIndex={-1}
|
|
136
|
+
muted
|
|
137
|
+
loop
|
|
138
|
+
playsInline
|
|
139
|
+
preload="auto"
|
|
140
|
+
onPlaying={() => setPlaying(true)}
|
|
141
|
+
onPause={() => setPlaying(false)}
|
|
142
|
+
>
|
|
143
|
+
<source src={withBase(src)} type={type} />
|
|
144
|
+
</video>
|
|
145
|
+
)}
|
|
146
|
+
{controls && load && near && (
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
className="fbv-toggle"
|
|
150
|
+
aria-label={playing ? pauseLabel : playLabel}
|
|
151
|
+
onClick={() => setHeld(playing)}
|
|
152
|
+
>
|
|
153
|
+
{playing ? <Pause size={20} aria-hidden="true" /> : <Play size={20} aria-hidden="true" />}
|
|
154
|
+
</button>
|
|
155
|
+
)}
|
|
156
|
+
</section>
|
|
157
|
+
);
|
|
158
|
+
}
|
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
|
@@ -36,6 +36,13 @@ export interface HeroProps {
|
|
|
36
36
|
trust?: HeroTrustItem[];
|
|
37
37
|
/** Anchor target for the scroll-down affordance, e.g. "#pain". */
|
|
38
38
|
scrollTarget?: string;
|
|
39
|
+
/**
|
|
40
|
+
* `overlay`, the default, sets the copy over a full bleed photo a screen
|
|
41
|
+
* tall. `split` sets the copy and its actions on the primary field on one
|
|
42
|
+
* side and the photo on the other, at the height the copy needs, stacking
|
|
43
|
+
* with the photo first on a phone; the scroll cue is left out.
|
|
44
|
+
*/
|
|
45
|
+
layout?: "overlay" | "split";
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
/** Full-bleed image hero with scrim, headline, CTA pair, and trust stats. */
|
|
@@ -48,6 +55,7 @@ export function Hero({
|
|
|
48
55
|
secondaryCTA,
|
|
49
56
|
trust,
|
|
50
57
|
scrollTarget,
|
|
58
|
+
layout = "overlay",
|
|
51
59
|
}: HeroProps) {
|
|
52
60
|
const withBase = useWithBase();
|
|
53
61
|
const ctaProps = (cta: HeroCTA, extra: Partial<ButtonProps>) => ({
|
|
@@ -56,50 +64,66 @@ export function Hero({
|
|
|
56
64
|
...extra,
|
|
57
65
|
});
|
|
58
66
|
|
|
67
|
+
const copy = (
|
|
68
|
+
<>
|
|
69
|
+
{eyebrow && <Eyebrow onDark>{eyebrow}</Eyebrow>}
|
|
70
|
+
<h1>{title}</h1>
|
|
71
|
+
{subtitle && <p className="hero-sub">{subtitle}</p>}
|
|
72
|
+
{(primaryCTA || secondaryCTA) && (
|
|
73
|
+
<div className="cta-row">
|
|
74
|
+
{primaryCTA && (
|
|
75
|
+
<Button {...ctaProps(primaryCTA, { size: "lg", arrow: true })}>
|
|
76
|
+
{primaryCTA.label}
|
|
77
|
+
</Button>
|
|
78
|
+
)}
|
|
79
|
+
{secondaryCTA && (
|
|
80
|
+
<Button {...ctaProps(secondaryCTA, { variant: "ghost", size: "lg", onDark: true })}>
|
|
81
|
+
{secondaryCTA.label}
|
|
82
|
+
</Button>
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
{trust && trust.length > 0 && (
|
|
87
|
+
<ul className="hero-trust">
|
|
88
|
+
{trust.map((item) => (
|
|
89
|
+
<li key={item.label}>
|
|
90
|
+
<strong>{item.value}</strong>
|
|
91
|
+
<span>{item.label}</span>
|
|
92
|
+
</li>
|
|
93
|
+
))}
|
|
94
|
+
</ul>
|
|
95
|
+
)}
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
const media = image ? (
|
|
99
|
+
<img
|
|
100
|
+
src={withBase(image.src)}
|
|
101
|
+
alt={image.alt}
|
|
102
|
+
fetchPriority="high"
|
|
103
|
+
{...(image.position ? { style: { objectPosition: image.position } } : {})}
|
|
104
|
+
/>
|
|
105
|
+
) : (
|
|
106
|
+
<div className="hero-media-fallback" />
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
if (layout === "split") {
|
|
110
|
+
return (
|
|
111
|
+
<section className="hero is-split">
|
|
112
|
+
<div className="hero-split-copy on-primary">
|
|
113
|
+
<div className="hero-split-inner">{copy}</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div className="hero-split-media">{media}</div>
|
|
116
|
+
</section>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
59
120
|
return (
|
|
60
121
|
<section className="hero">
|
|
61
122
|
<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
|
-
)}
|
|
123
|
+
{media}
|
|
72
124
|
<div className="hero-scrim" />
|
|
73
125
|
</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>
|
|
126
|
+
<div className="wrap hero-content">{copy}</div>
|
|
103
127
|
{scrollTarget && (
|
|
104
128
|
<a className="hero-scroll" href={withBase(scrollTarget)} aria-label="Scroll down">
|
|
105
129
|
↓
|
|
@@ -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,64 @@
|
|
|
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
|
+
href: string;
|
|
9
|
+
/**
|
|
10
|
+
* A figure the row carries, e.g. a city's count of finished jobs. It sits
|
|
11
|
+
* right aligned on the label's line in tabular numerals, so a column of
|
|
12
|
+
* counts lines up digit under digit.
|
|
13
|
+
*/
|
|
14
|
+
count?: ReactNode;
|
|
15
|
+
/** Opens in a new tab, except on mailto, tel, and sms links. */
|
|
16
|
+
external?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A column: a heading, itself a link when it has an `href`, over its links. */
|
|
20
|
+
export interface LinkColumn {
|
|
21
|
+
heading: string;
|
|
22
|
+
href?: string;
|
|
23
|
+
links: LinkColumnLink[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface LinkColumnsProps {
|
|
27
|
+
columns: LinkColumn[];
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Columns of links under a section's heading, each column a heading over
|
|
33
|
+
* its links, as many across as fit: a site's service areas by region, or a
|
|
34
|
+
* hub page's children. A link can carry a figure on its own line, right
|
|
35
|
+
* aligned, so a list of cities reads with their counts in one column.
|
|
36
|
+
*/
|
|
37
|
+
export function LinkColumns({ columns, className }: LinkColumnsProps) {
|
|
38
|
+
const withBase = useWithBase();
|
|
39
|
+
return (
|
|
40
|
+
<div className={["link-columns", className].filter(Boolean).join(" ")}>
|
|
41
|
+
{columns.map((column) => (
|
|
42
|
+
<div className="lc-col" key={column.heading}>
|
|
43
|
+
<h3 className="lc-head">
|
|
44
|
+
{column.href ? <a href={withBase(column.href)}>{column.heading}</a> : column.heading}
|
|
45
|
+
</h3>
|
|
46
|
+
<ul>
|
|
47
|
+
{column.links.map((link) => (
|
|
48
|
+
<li key={link.href}>
|
|
49
|
+
<a
|
|
50
|
+
className="lc-link"
|
|
51
|
+
href={withBase(link.href)}
|
|
52
|
+
{...newTabProps(link.href, link.external)}
|
|
53
|
+
>
|
|
54
|
+
<span className="lc-label">{link.label}</span>
|
|
55
|
+
{link.count != null && <span className="lc-count">{link.count}</span>}
|
|
56
|
+
</a>
|
|
57
|
+
</li>
|
|
58
|
+
))}
|
|
59
|
+
</ul>
|
|
60
|
+
</div>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -3,7 +3,7 @@ import { Eyebrow, Lead } from "../primitives";
|
|
|
3
3
|
import { Button } from "../primitives/Button";
|
|
4
4
|
import { HoursTable } from "./HoursTable";
|
|
5
5
|
import { MapEmbed, type MapEmbedSite } from "./MapEmbed";
|
|
6
|
-
import type { SiteConfig } from "./siteConfig";
|
|
6
|
+
import type { SiteConfig, Surface } from "./siteConfig";
|
|
7
7
|
|
|
8
8
|
/** The keys of the site config the section reads; a whole `SiteConfig` passes as it is. */
|
|
9
9
|
export type LocationSectionSite = MapEmbedSite &
|
|
@@ -14,6 +14,13 @@ export interface LocationSectionProps {
|
|
|
14
14
|
eyebrow?: string;
|
|
15
15
|
title: ReactNode;
|
|
16
16
|
lead?: ReactNode;
|
|
17
|
+
/** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
|
|
18
|
+
surface?: Surface;
|
|
19
|
+
/**
|
|
20
|
+
* The level of the section's title; the hours heading sits one below it,
|
|
21
|
+
* so the outline never skips a level. Defaults to 2.
|
|
22
|
+
*/
|
|
23
|
+
headingLevel?: 2 | 3 | 4 | 5;
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
/** Joins service areas into readable prose: "A, B, and C". */
|
|
@@ -27,20 +34,36 @@ function areasSentence(areas: string[]): string {
|
|
|
27
34
|
* map embed. Identical on every page that uses it — the service areas
|
|
28
35
|
* render as plain prose (crawlable text) from the site config.
|
|
29
36
|
*/
|
|
30
|
-
export function LocationSection({
|
|
37
|
+
export function LocationSection({
|
|
38
|
+
site,
|
|
39
|
+
eyebrow = "Find us",
|
|
40
|
+
title,
|
|
41
|
+
lead,
|
|
42
|
+
surface = "default",
|
|
43
|
+
headingLevel = 2,
|
|
44
|
+
}: LocationSectionProps) {
|
|
45
|
+
const Title = `h${headingLevel}` as const;
|
|
31
46
|
return (
|
|
32
|
-
<section
|
|
47
|
+
<section
|
|
48
|
+
className={["section location", surface === "alt" && "surface-alt"].filter(Boolean).join(" ")}
|
|
49
|
+
>
|
|
33
50
|
<div className="wrap location-grid">
|
|
34
51
|
<div>
|
|
35
52
|
<Eyebrow>{eyebrow}</Eyebrow>
|
|
36
|
-
<
|
|
53
|
+
<Title className="location-title">{title}</Title>
|
|
37
54
|
{lead && <Lead>{lead}</Lead>}
|
|
38
55
|
{site.serviceAreas.length > 0 && (
|
|
39
56
|
<p className="loc-areas">Proudly serving {areasSentence(site.serviceAreas)}.</p>
|
|
40
57
|
)}
|
|
41
58
|
|
|
42
59
|
<div className="loc-block">
|
|
43
|
-
|
|
60
|
+
{/* A heading by role, as the footer's column labels are
|
|
61
|
+
(Footer.tsx): a site's own bare heading rules would
|
|
62
|
+
restyle this small mono label. */}
|
|
63
|
+
{/* biome-ignore lint/a11y/useSemanticElements: a heading element would take a site's bare heading rules, see above */}
|
|
64
|
+
<div className="loc-heading" role="heading" aria-level={headingLevel + 1}>
|
|
65
|
+
Hours
|
|
66
|
+
</div>
|
|
44
67
|
<HoursTable hours={site.hours} clock={site.clock} />
|
|
45
68
|
</div>
|
|
46
69
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Navigation, Phone } from "lucide-react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
+
import { newTabProps } from "../lib/newTabProps";
|
|
3
4
|
import { Eyebrow, Lead } from "../primitives";
|
|
4
5
|
import { MapEmbed, type MapEmbedSite } from "./MapEmbed";
|
|
6
|
+
import type { Surface } from "./siteConfig";
|
|
5
7
|
|
|
6
8
|
export interface LocationEntry {
|
|
7
9
|
name: string;
|
|
@@ -22,6 +24,8 @@ export interface LocationsProps {
|
|
|
22
24
|
title: ReactNode;
|
|
23
25
|
lead?: ReactNode;
|
|
24
26
|
locations: LocationEntry[];
|
|
27
|
+
/** The band's background, so adjacent sections never wear the same one. Defaults to the page surface. */
|
|
28
|
+
surface?: Surface;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
/**
|
|
@@ -29,13 +33,22 @@ export interface LocationsProps {
|
|
|
29
33
|
* cards (address, hours, call, directions). Reusable for any business that
|
|
30
34
|
* runs more than one address.
|
|
31
35
|
*/
|
|
32
|
-
export function Locations({
|
|
36
|
+
export function Locations({
|
|
37
|
+
site,
|
|
38
|
+
eyebrow = "Find us",
|
|
39
|
+
title,
|
|
40
|
+
lead,
|
|
41
|
+
locations,
|
|
42
|
+
surface = "default",
|
|
43
|
+
}: LocationsProps) {
|
|
33
44
|
return (
|
|
34
|
-
<section
|
|
45
|
+
<section
|
|
46
|
+
className={["section locs", surface === "alt" && "surface-alt"].filter(Boolean).join(" ")}
|
|
47
|
+
>
|
|
35
48
|
<div className="wrap">
|
|
36
49
|
<Eyebrow>{eyebrow}</Eyebrow>
|
|
37
50
|
<h2>{title}</h2>
|
|
38
|
-
{lead && <Lead
|
|
51
|
+
{lead && <Lead>{lead}</Lead>}
|
|
39
52
|
<div className="locs-layout">
|
|
40
53
|
<div className="locs-map">
|
|
41
54
|
<MapEmbed site={site} />
|
|
@@ -56,7 +69,7 @@ export function Locations({ site, eyebrow = "Find us", title, lead, locations }:
|
|
|
56
69
|
<Phone size={14} aria-hidden />
|
|
57
70
|
{loc.phoneDisplay}
|
|
58
71
|
</a>
|
|
59
|
-
<a href={loc.mapLink}
|
|
72
|
+
<a href={loc.mapLink} {...newTabProps(loc.mapLink, true)}>
|
|
60
73
|
<Navigation size={14} aria-hidden />
|
|
61
74
|
Directions
|
|
62
75
|
</a>
|
|
@@ -1,27 +1,59 @@
|
|
|
1
|
+
import { Pause, Play } from "lucide-react";
|
|
2
|
+
import { useState } from "react";
|
|
1
3
|
import { Chip } from "../primitives/Chip";
|
|
2
4
|
|
|
3
5
|
export interface LogoMarqueeProps {
|
|
4
6
|
/** Items scrolled across the band (credentials, client names, press). */
|
|
5
7
|
items: string[];
|
|
6
8
|
ariaLabel?: string;
|
|
9
|
+
/**
|
|
10
|
+
* What a screen reader calls the control that stops and restarts the
|
|
11
|
+
* row; defaults to "Pause". It is a toggle, pressed while the row is
|
|
12
|
+
* still, so one name serves both ways.
|
|
13
|
+
*/
|
|
14
|
+
pauseLabel?: string;
|
|
7
15
|
}
|
|
8
16
|
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Dark band with an infinitely scrolling row of chips. The row is drawn
|
|
19
|
+
* twice so the loop is seamless; the copy is hidden from assistive tech, so
|
|
20
|
+
* each item is read once, and is not drawn at all under reduced motion,
|
|
21
|
+
* where the row stands still and wraps. A quiet control pauses the row
|
|
22
|
+
* (WCAG 2.2.2, moving content that runs past five seconds).
|
|
23
|
+
*/
|
|
24
|
+
export function LogoMarquee({
|
|
25
|
+
items,
|
|
26
|
+
ariaLabel = "Credentials",
|
|
27
|
+
pauseLabel = "Pause",
|
|
28
|
+
}: LogoMarqueeProps) {
|
|
29
|
+
const [paused, setPaused] = useState(false);
|
|
30
|
+
const row = (copy: boolean) => (
|
|
31
|
+
<div className="marquee-group" aria-hidden={copy || undefined}>
|
|
32
|
+
{items.map((item, i) => (
|
|
33
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two items may share a label
|
|
34
|
+
<Chip key={`${item}-${i}`} dot onDark>
|
|
35
|
+
{item}
|
|
36
|
+
</Chip>
|
|
37
|
+
))}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
13
40
|
return (
|
|
14
41
|
<section className="creds" aria-label={ariaLabel}>
|
|
15
|
-
<div className="marquee">
|
|
42
|
+
<div className="marquee" data-paused={paused || undefined}>
|
|
16
43
|
<div className="marquee-track">
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
<Chip key={`${item}-${i}`} dot onDark>
|
|
20
|
-
{item}
|
|
21
|
-
</Chip>
|
|
22
|
-
))}
|
|
44
|
+
{row(false)}
|
|
45
|
+
{row(true)}
|
|
23
46
|
</div>
|
|
24
47
|
</div>
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
className="marquee-pause"
|
|
51
|
+
aria-label={pauseLabel}
|
|
52
|
+
aria-pressed={paused}
|
|
53
|
+
onClick={() => setPaused((current) => !current)}
|
|
54
|
+
>
|
|
55
|
+
{paused ? <Play size={14} aria-hidden="true" /> : <Pause size={14} aria-hidden="true" />}
|
|
56
|
+
</button>
|
|
25
57
|
</section>
|
|
26
58
|
);
|
|
27
59
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MapPin, Navigation } from "lucide-react";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
+
import { newTabProps } from "../lib/newTabProps";
|
|
3
4
|
import { useWithBase } from "../routing/BasePathProvider";
|
|
4
5
|
import type { SiteConfig } from "./siteConfig";
|
|
5
6
|
|
|
@@ -27,14 +28,20 @@ export function MapEmbed({ site }: MapEmbedProps) {
|
|
|
27
28
|
const address = `${site.address.street}, ${site.address.locality} ${site.address.region} ${site.address.postalCode}`;
|
|
28
29
|
|
|
29
30
|
if (site.mapImage) {
|
|
31
|
+
const image = (
|
|
32
|
+
<img src={withBase(site.mapImage)} alt={`Map to ${site.name}, ${address}`} loading="lazy" />
|
|
33
|
+
);
|
|
34
|
+
// With nowhere to send a reader, the screenshot is a plain picture:
|
|
35
|
+
// a link to "#" would only jump to the top of the page.
|
|
36
|
+
if (!site.mapLinkURL) return <div className="map-frame map-static">{image}</div>;
|
|
30
37
|
return (
|
|
31
38
|
<a
|
|
32
39
|
className="map-frame map-static"
|
|
33
|
-
href={site.mapLinkURL
|
|
34
|
-
{...(site.mapLinkURL
|
|
40
|
+
href={site.mapLinkURL}
|
|
41
|
+
{...newTabProps(site.mapLinkURL, true)}
|
|
35
42
|
aria-label={`Get directions to ${site.name}, ${address}`}
|
|
36
43
|
>
|
|
37
|
-
|
|
44
|
+
{image}
|
|
38
45
|
<span className="map-directions">
|
|
39
46
|
<Navigation size={15} aria-hidden />
|
|
40
47
|
Get Directions
|
|
@@ -48,12 +55,9 @@ export function MapEmbed({ site }: MapEmbedProps) {
|
|
|
48
55
|
if (!loaded) {
|
|
49
56
|
return (
|
|
50
57
|
<div className="map-frame">
|
|
51
|
-
<button
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onClick={() => setLoaded(true)}
|
|
55
|
-
aria-label={`Load the map to ${site.name}, ${address}`}
|
|
56
|
-
>
|
|
58
|
+
<button type="button" className="map-facade" onClick={() => setLoaded(true)}>
|
|
59
|
+
{/* Named by its own words, the address and the hint, so a reader
|
|
60
|
+
who presses it by voice says what they see. */}
|
|
57
61
|
<MapPin size={28} aria-hidden />
|
|
58
62
|
<span className="map-facade-address">{address}</span>
|
|
59
63
|
<span className="map-facade-hint">Tap to load the map</span>
|