@atelic-action/ui 8.0.0 → 8.2.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 +187 -22
- package/bin/atelic-check-sentry.ts +5 -0
- package/dist/gate/middleware.js +15 -1
- package/dist/monitoring/server.d.ts +122 -0
- package/dist/monitoring/server.js +302 -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 +10 -2
- package/src/app/layout/DesktopRail.tsx +6 -4
- package/src/app/layout/MobileMenu.tsx +10 -5
- package/src/app/layout/MobileTabBar.tsx +3 -2
- package/src/app/layout/PageError.tsx +2 -2
- package/src/app/layout/SectionCards.tsx +7 -2
- package/src/app/layout/UserMenu.tsx +1 -1
- package/src/app/ui/alert.tsx +1 -1
- package/src/app/ui/form.tsx +2 -2
- package/src/artifact/AppErrorBoundary.tsx +12 -7
- package/src/chrome/BrandLockup.tsx +46 -7
- package/src/chrome/ContactDock.tsx +59 -13
- package/src/chrome/Footer.tsx +97 -28
- package/src/chrome/NavMegaPanel.tsx +11 -6
- package/src/chrome/SiteHeader.tsx +68 -18
- package/src/chrome/SiteMenu.tsx +207 -72
- package/src/chrome/SiteShell.tsx +25 -3
- package/src/chrome/StickyCTABar.tsx +24 -8
- package/src/chrome/index.ts +2 -0
- package/src/components/NotFound.tsx +3 -2
- package/src/gate/middleware.ts +15 -1
- package/src/lib/emailText.tsx +26 -0
- package/src/lib/phoneText.tsx +49 -0
- package/src/monitoring/ErrorCatcherScript.tsx +26 -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 +368 -0
- package/src/monitoring/start.ts +118 -0
- package/src/primitives/Button.tsx +3 -1
- package/src/primitives/Eyebrow.tsx +6 -2
- package/src/routing/index.ts +11 -32
- package/src/routing/miss.ts +32 -0
- package/src/routing/routerErrors.tsx +57 -0
- package/src/routing/staticNotFound.tsx +64 -0
- package/src/scripts/check-sentry.ts +98 -0
- package/src/sections/CalloutPanel.tsx +4 -1
- package/src/sections/ContactInfoCard.tsx +1 -1
- package/src/sections/FullBleedVideo.tsx +13 -4
- package/src/sections/Hero.tsx +10 -3
- package/src/sections/LinkColumns.tsx +30 -14
- package/src/sections/Locations.tsx +1 -1
- package/src/sections/LogoMarquee.tsx +1 -1
- package/src/sections/PricingBand.tsx +1 -1
- package/src/sections/ProcessSteps.tsx +1 -1
- package/src/sections/siteConfig.ts +67 -5
- package/src/styles/app.css +9 -0
- package/src/styles/base.css +34 -2
- package/src/styles/chrome.css +449 -41
- package/src/styles/defaults.css +61 -2
- package/src/styles/primitives.css +20 -7
- package/src/styles/sections.css +52 -9
- package/src/types.ts +40 -2
- package/src/vite/index.ts +4 -0
- package/src/vite/marketing-config.ts +81 -1
|
@@ -10,8 +10,16 @@ import {
|
|
|
10
10
|
} from "react";
|
|
11
11
|
import { useDismiss } from "../hooks/useDismiss";
|
|
12
12
|
import { type PageStop, useScrollSpy } from "../hooks/useScrollSpy";
|
|
13
|
-
import {
|
|
14
|
-
import type {
|
|
13
|
+
import { Button } from "../primitives/Button";
|
|
14
|
+
import type {
|
|
15
|
+
Brand,
|
|
16
|
+
CallToAction,
|
|
17
|
+
HeaderPhone,
|
|
18
|
+
MenuBurgerStyle,
|
|
19
|
+
MenuContact,
|
|
20
|
+
NavLink,
|
|
21
|
+
SiteMenuSurface,
|
|
22
|
+
} from "../types";
|
|
15
23
|
import { BrandLockup } from "./BrandLockup";
|
|
16
24
|
import { NavMegaPanel } from "./NavMegaPanel";
|
|
17
25
|
import { groupHrefs, isGroup } from "./navSections";
|
|
@@ -32,7 +40,10 @@ export interface SiteHeaderProps {
|
|
|
32
40
|
* mega menu panel, and in the phone's menu an accordion.
|
|
33
41
|
*/
|
|
34
42
|
links?: NavLink[];
|
|
35
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The primary action, in the bar on desktop and in the menu, where it
|
|
45
|
+
* reads its `menuLabel` when it has one.
|
|
46
|
+
*/
|
|
36
47
|
primaryCTA?: CallToAction;
|
|
37
48
|
/** Defaults to `solid`. */
|
|
38
49
|
variant?: SiteHeaderVariant;
|
|
@@ -51,8 +62,19 @@ export interface SiteHeaderProps {
|
|
|
51
62
|
/**
|
|
52
63
|
* Up to two numbers the bar shows on a desktop, each a tel link, with the
|
|
53
64
|
* first as a call button beside the burger on a phone. A third is dropped.
|
|
65
|
+
* A number's `label` sits over it in the bar's pill; the menu lists each
|
|
66
|
+
* with its `menuLabel`, else its `label`, else "Call".
|
|
54
67
|
*/
|
|
55
68
|
phones?: HeaderPhone[];
|
|
69
|
+
/**
|
|
70
|
+
* Words shown beside the burger, e.g. "Menu", which also name it. Absent,
|
|
71
|
+
* the burger is its three lines alone, named "Open menu" or "Close menu".
|
|
72
|
+
*/
|
|
73
|
+
menuLabel?: string;
|
|
74
|
+
/** The phone menu's sheet, `dark` (the default) or `light` (see `SiteMenu`). */
|
|
75
|
+
menuSurface?: SiteMenuSurface;
|
|
76
|
+
/** How the burger is drawn: the lines before its words, an outlined pill. Both off by default. */
|
|
77
|
+
burger?: MenuBurgerStyle;
|
|
56
78
|
}
|
|
57
79
|
|
|
58
80
|
/** The keys that move focus along the bar and down into an open panel. */
|
|
@@ -102,6 +124,9 @@ export function SiteHeader({
|
|
|
102
124
|
hideCTA = false,
|
|
103
125
|
contact,
|
|
104
126
|
phones,
|
|
127
|
+
menuLabel,
|
|
128
|
+
menuSurface = "dark",
|
|
129
|
+
burger,
|
|
105
130
|
}: SiteHeaderProps) {
|
|
106
131
|
const [scrolled, setScrolled] = useState(false);
|
|
107
132
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
@@ -232,7 +257,8 @@ export function SiteHeader({
|
|
|
232
257
|
>
|
|
233
258
|
{links.map((link, index) =>
|
|
234
259
|
isGroup(link) ? (
|
|
235
|
-
|
|
260
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a one page site points several entries at one page or anchor, so the place keeps the key unique; the bar never reorders
|
|
261
|
+
<div className="nav-item" key={index}>
|
|
236
262
|
<button
|
|
237
263
|
type="button"
|
|
238
264
|
id={`${baseId}g${index}`}
|
|
@@ -282,7 +308,8 @@ export function SiteHeader({
|
|
|
282
308
|
</div>
|
|
283
309
|
) : (
|
|
284
310
|
<a
|
|
285
|
-
|
|
311
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: as above, entries may share an href
|
|
312
|
+
key={index}
|
|
286
313
|
href={link.href}
|
|
287
314
|
aria-current={currentPath === link.href ? "page" : undefined}
|
|
288
315
|
onPointerEnter={(event) => {
|
|
@@ -307,7 +334,7 @@ export function SiteHeader({
|
|
|
307
334
|
<PhoneIcon size={17} aria-hidden="true" />
|
|
308
335
|
<span className="nav-phone-text">
|
|
309
336
|
{phone.label && <span className="nav-phone-label">{phone.label}</span>}
|
|
310
|
-
<span className="nav-phone-number">{phone.display}</span>
|
|
337
|
+
<span className="nav-phone-number tel-number">{phone.display}</span>
|
|
311
338
|
</span>
|
|
312
339
|
</a>
|
|
313
340
|
))}
|
|
@@ -318,20 +345,19 @@ export function SiteHeader({
|
|
|
318
345
|
// display rule lives outside the atelic-ui layer and would beat
|
|
319
346
|
// any rule here that hid the button itself.
|
|
320
347
|
<span className="nav-cta">
|
|
321
|
-
<
|
|
322
|
-
className="btn btn-primary"
|
|
323
|
-
href={barCTA.href}
|
|
324
|
-
{...newTabProps(barCTA.href, barCTA.external)}
|
|
325
|
-
>
|
|
348
|
+
<Button href={barCTA.href} newTab={barCTA.external} arrow={barCTA.arrow}>
|
|
326
349
|
{barCTA.label}
|
|
327
|
-
</
|
|
350
|
+
</Button>
|
|
328
351
|
</span>
|
|
329
352
|
)}
|
|
330
353
|
{barPhones[0] && (
|
|
331
354
|
<a
|
|
332
355
|
className="nav-call"
|
|
333
356
|
href={`tel:${barPhones[0].e164}`}
|
|
334
|
-
|
|
357
|
+
// An icon alone: a number with no label is named "Call" and the number.
|
|
358
|
+
aria-label={
|
|
359
|
+
barPhones[0].label ? phoneName(barPhones[0]) : `Call ${barPhones[0].display}`
|
|
360
|
+
}
|
|
335
361
|
>
|
|
336
362
|
<PhoneIcon size={19} aria-hidden="true" />
|
|
337
363
|
</a>
|
|
@@ -339,15 +365,37 @@ export function SiteHeader({
|
|
|
339
365
|
{hasMenu && (
|
|
340
366
|
<button
|
|
341
367
|
type="button"
|
|
342
|
-
className=
|
|
343
|
-
|
|
368
|
+
className={[
|
|
369
|
+
"nav-burger",
|
|
370
|
+
menuLabel && "has-label",
|
|
371
|
+
menuLabel && burger?.labelAfter && "is-label-after",
|
|
372
|
+
burger?.outlined && "is-outlined",
|
|
373
|
+
]
|
|
374
|
+
.filter(Boolean)
|
|
375
|
+
.join(" ")}
|
|
376
|
+
// Words beside the burger name it, so the name holds what a reader
|
|
377
|
+
// sees; the open state is aria-expanded's to say.
|
|
378
|
+
aria-label={menuLabel ? undefined : menuOpen ? "Close menu" : "Open menu"}
|
|
344
379
|
aria-expanded={menuOpen}
|
|
345
380
|
aria-controls={menuId}
|
|
346
381
|
onClick={() => setMenuOpen((open) => !open)}
|
|
347
382
|
>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
383
|
+
{menuLabel ? (
|
|
384
|
+
<>
|
|
385
|
+
<span className="nav-burger-label">{menuLabel}</span>
|
|
386
|
+
<span className="nav-burger-lines" aria-hidden="true">
|
|
387
|
+
<span />
|
|
388
|
+
<span />
|
|
389
|
+
<span />
|
|
390
|
+
</span>
|
|
391
|
+
</>
|
|
392
|
+
) : (
|
|
393
|
+
<>
|
|
394
|
+
<span />
|
|
395
|
+
<span />
|
|
396
|
+
<span />
|
|
397
|
+
</>
|
|
398
|
+
)}
|
|
351
399
|
</button>
|
|
352
400
|
)}
|
|
353
401
|
</div>
|
|
@@ -362,6 +410,8 @@ export function SiteHeader({
|
|
|
362
410
|
contact={stops ? undefined : contact}
|
|
363
411
|
phones={barPhones.length > 0 ? barPhones : undefined}
|
|
364
412
|
currentPath={currentPath}
|
|
413
|
+
surface={menuSurface}
|
|
414
|
+
brand={brand}
|
|
365
415
|
/>
|
|
366
416
|
)}
|
|
367
417
|
</>
|
package/src/chrome/SiteMenu.tsx
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { ChevronDown } from "lucide-react";
|
|
1
|
+
import { ChevronDown, X } from "lucide-react";
|
|
2
2
|
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { newTabProps } from "../lib/newTabProps";
|
|
4
|
+
import { telText } from "../lib/phoneText";
|
|
5
|
+
import { Button } from "../primitives/Button";
|
|
4
6
|
import type {
|
|
7
|
+
Brand,
|
|
5
8
|
CallToAction,
|
|
6
9
|
HeaderPhone,
|
|
7
10
|
MenuContact,
|
|
8
11
|
NavGroupChildLink,
|
|
9
12
|
NavLink,
|
|
10
13
|
NavPanelSection,
|
|
14
|
+
Phone,
|
|
15
|
+
SiteMenuSurface,
|
|
11
16
|
} from "../types";
|
|
17
|
+
import { BrandLockup } from "./BrandLockup";
|
|
12
18
|
import { NavBadge } from "./NavBadge";
|
|
13
19
|
import { isGroup, isLinkColumn, panelSections } from "./navSections";
|
|
14
20
|
|
|
21
|
+
/** A number as the menu lists it: the header's, or the contact block's one phone. */
|
|
22
|
+
type MenuPhone = Phone & { label?: string; menuLabel?: string };
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The words the menu sets with a number: its `menuLabel`, else its `label`,
|
|
26
|
+
* else "Call", which asserts nothing a business may not do (answer texts).
|
|
27
|
+
*/
|
|
28
|
+
export function menuPhoneLabel(phone: MenuPhone): string {
|
|
29
|
+
return phone.menuLabel ?? phone.label ?? "Call";
|
|
30
|
+
}
|
|
31
|
+
|
|
15
32
|
export interface SiteMenuProps {
|
|
16
33
|
/** Whether the menu is showing. The owner holds this state. */
|
|
17
34
|
open: boolean;
|
|
@@ -26,20 +43,42 @@ export interface SiteMenuProps {
|
|
|
26
43
|
* An entry with `columns` is a group, an accordion that opens one at a time.
|
|
27
44
|
*/
|
|
28
45
|
links: NavLink[];
|
|
29
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* The primary action, rendered as a standard button below the entries, in
|
|
48
|
+
* its `menuLabel` when it has one, else its `label`.
|
|
49
|
+
*/
|
|
30
50
|
primaryCTA?: CallToAction;
|
|
31
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* The phone, email, and address block at the foot of the dark sheet. The
|
|
53
|
+
* light sheet draws its one phone as a card when `phones` is empty, and
|
|
54
|
+
* leaves the email and the address out, as its design does.
|
|
55
|
+
*/
|
|
32
56
|
contact?: MenuContact;
|
|
33
57
|
/**
|
|
34
58
|
* The numbers the header shows, each a tel link at the foot with its
|
|
35
|
-
* label, in place of the contact
|
|
59
|
+
* `menuLabel`, else its `label`, else "Call", in place of the contact
|
|
60
|
+
* block's one phone.
|
|
36
61
|
*/
|
|
37
62
|
phones?: HeaderPhone[];
|
|
38
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* The path being read, marking the matching link with aria-current and,
|
|
65
|
+
* for the eye, the 2px underline the bar marks its current entry with.
|
|
66
|
+
*/
|
|
39
67
|
currentPath?: string;
|
|
40
68
|
id?: string;
|
|
41
69
|
/** The dialog's accessible name. Defaults to "Menu". */
|
|
42
70
|
label?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The sheet's look. `dark` (the default) is the full screen sheet on the
|
|
73
|
+
* dark surface. `light` sets the page's ground: the brand's lockup and a
|
|
74
|
+
* round close button across the top, the entries as rows under hairlines,
|
|
75
|
+
* and a foot on the alternate ground holding the call to action and a
|
|
76
|
+
* card per number; it shows no email and no address, which the dark
|
|
77
|
+
* sheet's contact block does. The behavior is the same on both.
|
|
78
|
+
*/
|
|
79
|
+
surface?: SiteMenuSurface;
|
|
80
|
+
/** The identity the light sheet's top row draws, linking home. */
|
|
81
|
+
brand?: Brand;
|
|
43
82
|
}
|
|
44
83
|
|
|
45
84
|
/**
|
|
@@ -47,13 +86,18 @@ export interface SiteMenuProps {
|
|
|
47
86
|
* `<dialog>`: the platform supplies Escape, focus containment, and focus
|
|
48
87
|
* return to the burger. The dialog renders closed on the server and opens
|
|
49
88
|
* only in an effect, so the menu stays safe to prerender. Page scroll holds
|
|
50
|
-
* still through chrome.css while the dialog is open
|
|
89
|
+
* still through chrome.css while the dialog is open, and the contact dock's
|
|
90
|
+
* launcher steps aside.
|
|
51
91
|
*
|
|
52
92
|
* A group is an accordion: its label is a control that opens the group's
|
|
53
93
|
* columns under it and closes whichever group was open. Every group starts
|
|
54
94
|
* closed each time the menu opens, the one holding the current page
|
|
55
95
|
* included, so the menu always opens on the short list of entries. A closed
|
|
56
96
|
* group's links stay in the HTML, `inert`.
|
|
97
|
+
*
|
|
98
|
+
* Two sheets share every behavior and differ in look alone (`surface`): the
|
|
99
|
+
* dark one, and the light one with the lockup across the top and the call to
|
|
100
|
+
* action and the numbers in a foot.
|
|
57
101
|
*/
|
|
58
102
|
export function SiteMenu({
|
|
59
103
|
open,
|
|
@@ -65,16 +109,21 @@ export function SiteMenu({
|
|
|
65
109
|
currentPath,
|
|
66
110
|
id,
|
|
67
111
|
label = "Menu",
|
|
112
|
+
surface = "dark",
|
|
113
|
+
brand,
|
|
68
114
|
}: SiteMenuProps) {
|
|
115
|
+
const light = surface === "light";
|
|
69
116
|
const [openGroup, setOpenGroup] = useState<number | null>(null);
|
|
70
117
|
const groupId = useId();
|
|
71
118
|
const dialogRef = useRef<HTMLDialogElement>(null);
|
|
119
|
+
const closeRef = useRef<HTMLButtonElement>(null);
|
|
72
120
|
// Whether the owner already knows the menu is closed. Escape fires cancel
|
|
73
121
|
// and then close, and a followed link closes the dialog and notifies
|
|
74
122
|
// directly, so every path runs through reportClosed and reports once.
|
|
75
123
|
const closedRef = useRef(true);
|
|
76
124
|
// Only a plain entry wears a number, so the numbers count those alone and
|
|
77
|
-
// run 01, 02, 03 down the menu whatever groups sit between them.
|
|
125
|
+
// run 01, 02, 03 down the menu whatever groups sit between them. The light
|
|
126
|
+
// sheet sets none.
|
|
78
127
|
const numbers: number[] = [];
|
|
79
128
|
let counted = 0;
|
|
80
129
|
for (const link of links) numbers.push(isGroup(link) ? 0 : ++counted);
|
|
@@ -85,9 +134,14 @@ export function SiteMenu({
|
|
|
85
134
|
closedRef.current = !open;
|
|
86
135
|
// No group is open when the menu opens, whatever page it opens on.
|
|
87
136
|
if (open) setOpenGroup(null);
|
|
88
|
-
if (open && !dialog.open)
|
|
137
|
+
if (open && !dialog.open) {
|
|
138
|
+
dialog.showModal();
|
|
139
|
+
// The light sheet's first stop is the lockup's home link, so focus
|
|
140
|
+
// starts on its close button, where the dark sheet's already does.
|
|
141
|
+
if (light) closeRef.current?.focus();
|
|
142
|
+
}
|
|
89
143
|
if (!open && dialog.open) dialog.close();
|
|
90
|
-
}, [open]);
|
|
144
|
+
}, [open, light]);
|
|
91
145
|
|
|
92
146
|
const reportClosed = () => {
|
|
93
147
|
if (closedRef.current) return;
|
|
@@ -104,6 +158,135 @@ export function SiteMenu({
|
|
|
104
158
|
reportClosed();
|
|
105
159
|
};
|
|
106
160
|
|
|
161
|
+
// The menu's own words for the action, else the bar's.
|
|
162
|
+
const menuCTA = primaryCTA && { ...primaryCTA, label: primaryCTA.menuLabel ?? primaryCTA.label };
|
|
163
|
+
|
|
164
|
+
const closeButton = (
|
|
165
|
+
<button
|
|
166
|
+
ref={closeRef}
|
|
167
|
+
type="button"
|
|
168
|
+
className="mm-close"
|
|
169
|
+
aria-label="Close menu"
|
|
170
|
+
onClick={close}
|
|
171
|
+
>
|
|
172
|
+
{light ? (
|
|
173
|
+
<X size={20} aria-hidden="true" />
|
|
174
|
+
) : (
|
|
175
|
+
<>
|
|
176
|
+
<span />
|
|
177
|
+
<span />
|
|
178
|
+
</>
|
|
179
|
+
)}
|
|
180
|
+
</button>
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
const entries = links.map((link, i) =>
|
|
184
|
+
isGroup(link) ? (
|
|
185
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a one page site points several entries at one page or anchor, so the place keeps the key unique; the menu never reorders
|
|
186
|
+
<div className="mm-group" key={i}>
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
className="mm-link mm-group-btn"
|
|
190
|
+
aria-expanded={openGroup === i}
|
|
191
|
+
aria-controls={`${groupId}${i}`}
|
|
192
|
+
onClick={() => setOpenGroup((current) => (current === i ? null : i))}
|
|
193
|
+
>
|
|
194
|
+
<span>{link.label}</span>
|
|
195
|
+
<ChevronDown className="mm-chevron" size={light ? 20 : 22} aria-hidden="true" />
|
|
196
|
+
</button>
|
|
197
|
+
<div
|
|
198
|
+
id={`${groupId}${i}`}
|
|
199
|
+
className={["mm-group-panel", openGroup === i && "is-open"].filter(Boolean).join(" ")}
|
|
200
|
+
inert={openGroup !== i}
|
|
201
|
+
>
|
|
202
|
+
{link.allLabel && (
|
|
203
|
+
<a
|
|
204
|
+
className="mm-group-all"
|
|
205
|
+
href={link.href}
|
|
206
|
+
onClick={close}
|
|
207
|
+
aria-current={currentPath === link.href ? "page" : undefined}
|
|
208
|
+
>
|
|
209
|
+
{link.allLabel}
|
|
210
|
+
</a>
|
|
211
|
+
)}
|
|
212
|
+
{panelSections(link).map((section, index) => (
|
|
213
|
+
<MenuSection
|
|
214
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a group's sections never reorder while the menu is open
|
|
215
|
+
key={index}
|
|
216
|
+
section={section}
|
|
217
|
+
currentPath={currentPath}
|
|
218
|
+
onNavigate={close}
|
|
219
|
+
/>
|
|
220
|
+
))}
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
) : (
|
|
224
|
+
<a
|
|
225
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: as above, entries may share an href
|
|
226
|
+
key={i}
|
|
227
|
+
className="mm-link"
|
|
228
|
+
href={link.href}
|
|
229
|
+
onClick={close}
|
|
230
|
+
aria-current={currentPath === link.href ? "page" : undefined}
|
|
231
|
+
>
|
|
232
|
+
<span className="mm-label">{link.label}</span>
|
|
233
|
+
{!light && <span className="idx">{String(numbers[i]).padStart(2, "0")}</span>}
|
|
234
|
+
</a>
|
|
235
|
+
),
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
if (light) {
|
|
239
|
+
// A card per number the header shows, else the contact block's one phone.
|
|
240
|
+
const cards: MenuPhone[] = phones ?? (contact?.phone ? [contact.phone] : []);
|
|
241
|
+
return (
|
|
242
|
+
<dialog
|
|
243
|
+
ref={dialogRef}
|
|
244
|
+
id={id}
|
|
245
|
+
className="mobile-menu is-light"
|
|
246
|
+
aria-label={label}
|
|
247
|
+
onCancel={reportClosed}
|
|
248
|
+
onClose={reportClosed}
|
|
249
|
+
>
|
|
250
|
+
<div className="mm-top">
|
|
251
|
+
{brand && <BrandLockup brand={brand} surface="light" onClick={close} />}
|
|
252
|
+
{closeButton}
|
|
253
|
+
</div>
|
|
254
|
+
<div className="mm-list">{entries}</div>
|
|
255
|
+
{(menuCTA || cards.length > 0) && (
|
|
256
|
+
<div className="mm-foot">
|
|
257
|
+
{menuCTA && (
|
|
258
|
+
<Button
|
|
259
|
+
size="lg"
|
|
260
|
+
className="mm-cta"
|
|
261
|
+
href={menuCTA.href}
|
|
262
|
+
newTab={menuCTA.external}
|
|
263
|
+
arrow={menuCTA.arrow}
|
|
264
|
+
onClick={close}
|
|
265
|
+
>
|
|
266
|
+
{menuCTA.label}
|
|
267
|
+
</Button>
|
|
268
|
+
)}
|
|
269
|
+
{cards.map((line) => {
|
|
270
|
+
const words = menuPhoneLabel(line);
|
|
271
|
+
return (
|
|
272
|
+
// The words and the number are one name, spaced as they read.
|
|
273
|
+
<a
|
|
274
|
+
key={line.e164}
|
|
275
|
+
className="mm-phone-card"
|
|
276
|
+
href={`tel:${line.e164}`}
|
|
277
|
+
aria-label={`${words} ${line.display}`}
|
|
278
|
+
>
|
|
279
|
+
<span className="mm-phone-label">{words}</span>
|
|
280
|
+
<span className="mm-phone-number tel-number">{line.display}</span>
|
|
281
|
+
</a>
|
|
282
|
+
);
|
|
283
|
+
})}
|
|
284
|
+
</div>
|
|
285
|
+
)}
|
|
286
|
+
</dialog>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
107
290
|
return (
|
|
108
291
|
<dialog
|
|
109
292
|
ref={dialogRef}
|
|
@@ -113,66 +296,18 @@ export function SiteMenu({
|
|
|
113
296
|
onCancel={reportClosed}
|
|
114
297
|
onClose={reportClosed}
|
|
115
298
|
>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
type="button"
|
|
125
|
-
className="mm-link mm-group-btn"
|
|
126
|
-
aria-expanded={openGroup === i}
|
|
127
|
-
aria-controls={`${groupId}${i}`}
|
|
128
|
-
onClick={() => setOpenGroup((current) => (current === i ? null : i))}
|
|
129
|
-
>
|
|
130
|
-
<span>{link.label}</span>
|
|
131
|
-
<ChevronDown className="mm-chevron" size={22} aria-hidden="true" />
|
|
132
|
-
</button>
|
|
133
|
-
<div
|
|
134
|
-
id={`${groupId}${i}`}
|
|
135
|
-
className={["mm-group-panel", openGroup === i && "is-open"].filter(Boolean).join(" ")}
|
|
136
|
-
inert={openGroup !== i}
|
|
137
|
-
>
|
|
138
|
-
{link.allLabel && (
|
|
139
|
-
<a className="mm-group-all" href={link.href} onClick={close}>
|
|
140
|
-
{link.allLabel}
|
|
141
|
-
</a>
|
|
142
|
-
)}
|
|
143
|
-
{panelSections(link).map((section, index) => (
|
|
144
|
-
<MenuSection
|
|
145
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: a group's sections never reorder while the menu is open
|
|
146
|
-
key={index}
|
|
147
|
-
section={section}
|
|
148
|
-
currentPath={currentPath}
|
|
149
|
-
onNavigate={close}
|
|
150
|
-
/>
|
|
151
|
-
))}
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
) : (
|
|
155
|
-
<a
|
|
156
|
-
key={link.href}
|
|
157
|
-
className="mm-link"
|
|
158
|
-
href={link.href}
|
|
159
|
-
onClick={close}
|
|
160
|
-
aria-current={currentPath === link.href ? "page" : undefined}
|
|
161
|
-
>
|
|
162
|
-
<span>{link.label}</span>
|
|
163
|
-
<span className="idx">{String(numbers[i]).padStart(2, "0")}</span>
|
|
164
|
-
</a>
|
|
165
|
-
),
|
|
166
|
-
)}
|
|
167
|
-
{primaryCTA && (
|
|
168
|
-
<a
|
|
169
|
-
className="btn btn-primary btn-lg mm-cta"
|
|
170
|
-
href={primaryCTA.href}
|
|
299
|
+
{closeButton}
|
|
300
|
+
{entries}
|
|
301
|
+
{menuCTA && (
|
|
302
|
+
<Button
|
|
303
|
+
size="lg"
|
|
304
|
+
className="mm-cta"
|
|
305
|
+
href={menuCTA.href}
|
|
306
|
+
newTab={menuCTA.external}
|
|
171
307
|
onClick={close}
|
|
172
|
-
{...newTabProps(primaryCTA.href, primaryCTA.external)}
|
|
173
308
|
>
|
|
174
|
-
{
|
|
175
|
-
</
|
|
309
|
+
{menuCTA.label}
|
|
310
|
+
</Button>
|
|
176
311
|
)}
|
|
177
312
|
{(contact || phones) && <ContactBlock contact={contact ?? {}} phones={phones} />}
|
|
178
313
|
</dialog>
|
|
@@ -202,19 +337,19 @@ function MenuSection({
|
|
|
202
337
|
// A child may share its parent's href, and two rows may share one, so a
|
|
203
338
|
// link is keyed by its place, never its href alone.
|
|
204
339
|
const link = (
|
|
205
|
-
item: { label: string; href: string; external?: boolean; badge?: string },
|
|
340
|
+
item: { label: string; href: string; external?: boolean; badge?: string; quiet?: boolean },
|
|
206
341
|
className: string,
|
|
207
342
|
key: string,
|
|
208
343
|
) => (
|
|
209
344
|
<a
|
|
210
345
|
key={key}
|
|
211
|
-
className={className}
|
|
346
|
+
className={item.quiet ? `${className} is-quiet` : className}
|
|
212
347
|
href={item.href}
|
|
213
348
|
onClick={onNavigate}
|
|
214
349
|
aria-current={currentPath === item.href ? "page" : undefined}
|
|
215
350
|
{...newTabProps(item.href, item.external)}
|
|
216
351
|
>
|
|
217
|
-
{item.label}
|
|
352
|
+
<span className="mm-label">{telText(item.href, item.label)}</span>
|
|
218
353
|
<Badge text={item.badge} />
|
|
219
354
|
</a>
|
|
220
355
|
);
|
|
@@ -280,7 +415,7 @@ function ContactBlock({
|
|
|
280
415
|
? phones.map((line) => (
|
|
281
416
|
<span key={line.e164}>
|
|
282
417
|
<a className="mm-contact-link" href={`tel:${line.e164}`}>
|
|
283
|
-
{line.
|
|
418
|
+
{menuPhoneLabel(line).toUpperCase()} {line.display}
|
|
284
419
|
</a>
|
|
285
420
|
<br />
|
|
286
421
|
</span>
|
|
@@ -288,7 +423,7 @@ function ContactBlock({
|
|
|
288
423
|
: phone && (
|
|
289
424
|
<>
|
|
290
425
|
<a className="mm-contact-link" href={`tel:${phone.e164}`}>
|
|
291
|
-
|
|
426
|
+
{menuPhoneLabel(phone).toUpperCase()} {phone.display}
|
|
292
427
|
</a>
|
|
293
428
|
<br />
|
|
294
429
|
</>
|
package/src/chrome/SiteShell.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ReactNode, useCallback, useRef } from "react";
|
|
2
2
|
import { Watermark } from "../components/Watermark";
|
|
3
3
|
import type { PageStop } from "../hooks/useScrollSpy";
|
|
4
|
+
import { formatHoursRange } from "../lib/hours";
|
|
4
5
|
import { BasePathProvider } from "../routing/BasePathProvider";
|
|
5
6
|
import { joinBase, normalizeBasePath, stripBase } from "../routing/basePath";
|
|
6
7
|
import type { Density, NavItem, SiteConfig } from "../sections/siteConfig";
|
|
@@ -140,6 +141,8 @@ export function SiteShell({
|
|
|
140
141
|
else root.style.removeProperty("--sticky-cta-space");
|
|
141
142
|
}, []);
|
|
142
143
|
const cta = { ...site.cta, href: withBase(site.cta.href) };
|
|
144
|
+
// The phone's sticky bar may carry its own words (`cta.stickyLabel`).
|
|
145
|
+
const stickyLink = { ...cta, label: site.cta.stickyLabel ?? cta.label };
|
|
143
146
|
// Every link and picture a panel section holds, based.
|
|
144
147
|
const section = (part: NavPanelSection): NavPanelSection => {
|
|
145
148
|
if (isLinkColumn(part)) {
|
|
@@ -202,6 +205,19 @@ export function SiteShell({
|
|
|
202
205
|
},
|
|
203
206
|
{ heading: "Legal", links: based(site.legalLinks) ?? [] },
|
|
204
207
|
];
|
|
208
|
+
// The footer's hours, formatted as the footer prints them, unless the site
|
|
209
|
+
// keeps them out; the config's hours still feed its structured data.
|
|
210
|
+
const footerHours =
|
|
211
|
+
site.footer?.showHours === false
|
|
212
|
+
? undefined
|
|
213
|
+
: site.hours?.map((row) => ({
|
|
214
|
+
label: row.labelShort,
|
|
215
|
+
range: formatHoursRange(row, { short: true, clock: site.clock }),
|
|
216
|
+
}));
|
|
217
|
+
// The rating links to the Google profile: the site's own link for it, else
|
|
218
|
+
// the profile the address already links to.
|
|
219
|
+
const rating = site.footer?.rating;
|
|
220
|
+
const ratingHref = rating ? (site.footer?.ratingHref ?? site.mapLinkURL) : undefined;
|
|
205
221
|
// The header takes one variant. A hero page wins over a dark one: the bar
|
|
206
222
|
// sits transparent over the hero either way, and only its scrolled state
|
|
207
223
|
// differed.
|
|
@@ -225,6 +241,9 @@ export function SiteShell({
|
|
|
225
241
|
hideCTA={hideNavCTA}
|
|
226
242
|
contact={{ phone: site.phone, email: site.email, address: site.address }}
|
|
227
243
|
phones={site.header?.phones}
|
|
244
|
+
menuLabel={site.menuLabel}
|
|
245
|
+
menuSurface={site.menu?.surface}
|
|
246
|
+
burger={site.menu?.burger}
|
|
228
247
|
/>
|
|
229
248
|
<main id="main" className={heroNav ? undefined : "clears-nav"}>
|
|
230
249
|
{children}
|
|
@@ -233,20 +252,23 @@ export function SiteShell({
|
|
|
233
252
|
the bar is there from the top; the hero home page keeps the slide in. */}
|
|
234
253
|
{stickyCTA && (
|
|
235
254
|
<StickyCTABar
|
|
236
|
-
primaryCTA={
|
|
255
|
+
primaryCTA={stickyLink}
|
|
237
256
|
phone={site.phone}
|
|
238
|
-
fromTop={!heroNav}
|
|
257
|
+
fromTop={site.cta.stickyFromTop ?? !heroNav}
|
|
239
258
|
onSpaceChange={setBarSpace}
|
|
240
259
|
/>
|
|
241
260
|
)}
|
|
242
261
|
{footer ? (
|
|
243
262
|
<Footer
|
|
244
263
|
brand={brand}
|
|
245
|
-
rating={
|
|
264
|
+
rating={rating}
|
|
265
|
+
ratingHref={ratingHref}
|
|
266
|
+
ratingLabel={site.footer?.ratingLabel}
|
|
246
267
|
address={site.footer?.showAddress === false ? undefined : site.address}
|
|
247
268
|
addressHref={site.mapLinkURL}
|
|
248
269
|
phone={site.phone}
|
|
249
270
|
email={site.email}
|
|
271
|
+
hours={footerHours}
|
|
250
272
|
columns={footerColumns}
|
|
251
273
|
attribution={site.attribution}
|
|
252
274
|
note={site.footer?.note}
|