@atelic-action/ui 6.0.0 → 7.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 +32 -5
- package/package.json +1 -1
- package/src/artifact/Paragraph.tsx +38 -11
- package/src/artifact/index.ts +3 -0
- package/src/chrome/Footer.tsx +143 -122
- package/src/chrome/SiteShell.tsx +18 -11
- package/src/chrome/index.ts +3 -0
- package/src/sections/siteConfig.ts +17 -13
- package/src/styles/chrome.css +42 -46
- package/src/types.ts +25 -3
package/README.md
CHANGED
|
@@ -12,12 +12,12 @@ Every export, grouped by the entry it is imported from. The gallery column links
|
|
|
12
12
|
|---|---|---|---|
|
|
13
13
|
| `SiteHeader` | `@atelic-action/ui/chrome` | The fixed bar: the lockup, the nav or a page's own stops, the call to action, the burger; transparent, solid, or dark | [#site-header](https://ui.atelic.me/#site-header) |
|
|
14
14
|
| `SiteMenu` | `@atelic-action/ui/chrome` | The phone's full screen menu, on a native modal dialog | [#site-menu](https://ui.atelic.me/#site-menu) |
|
|
15
|
-
| `Footer` | `@atelic-action/ui/chrome` | The
|
|
15
|
+
| `Footer` | `@atelic-action/ui/chrome` | The default footer: the brand column (logo, Google rating, linked address, phone, email), the link columns, and the closing bar | [#footer](https://ui.atelic.me/#footer) |
|
|
16
16
|
| `ClosingBar`, `Copyright`, `Credit` | `@atelic-action/ui/chrome` | The line that closes every page, in two sides that each take anything: by default `Copyright` with the business's name on the left and `Credit`, the practice's made with line, on the right | [#closing-bar](https://ui.atelic.me/#closing-bar) |
|
|
17
17
|
| `StickyCTABar` | `@atelic-action/ui/chrome` | The phone's bottom bar: the call to action and a call shortcut, there from the top on an interior page (`fromTop`) and sliding in after a scroll on a hero page | [#sticky-cta-bar](https://ui.atelic.me/#sticky-cta-bar) |
|
|
18
18
|
| `BrandLockup` | `@atelic-action/ui/chrome` | The header's identity as one link, with the recipient's mark on a sent document | [#brand-lockup](https://ui.atelic.me/#brand-lockup) |
|
|
19
19
|
| `SkipLink` | `@atelic-action/ui/chrome` | The keyboard user's jump past the chrome | [#skip-link](https://ui.atelic.me/#skip-link) |
|
|
20
|
-
| `Brand`, `BrandLogo`, `CallToAction`, `HoursRow`, `MenuContact`, `NavLink`, `Phone`, `PostalAddress`, `SiteLink`, `SocialLink`, `PageStop` | `@atelic-action/ui/chrome` | The shapes the chrome renders from (types) | none |
|
|
20
|
+
| `Brand`, `BrandLogo`, `CallToAction`, `HoursRow`, `MenuContact`, `NavLink`, `Phone`, `PostalAddress`, `SiteLink`, `SocialLink`, `PageStop`, `FooterColumn`, `FooterColumnLink`, `FooterIcon` | `@atelic-action/ui/chrome` | The shapes the chrome renders from (types) | none |
|
|
21
21
|
| `NotFound` | `@atelic-action/ui/components` | The body of the page an unknown path renders | [#not-found](https://ui.atelic.me/#not-found) |
|
|
22
22
|
| `Checklist` | `@atelic-action/ui/components` | A short list of checks, each passed or failed | [#checklist](https://ui.atelic.me/#checklist) |
|
|
23
23
|
| `IconList` | `@atelic-action/ui/components` | A list whose bullets are icons, one for the list or one per item, each in a tone | [#icon-list](https://ui.atelic.me/#icon-list) |
|
|
@@ -41,7 +41,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
|
|
|
41
41
|
| `GradeChip`, `gradeLabel`, `WriteupGrade` | `@atelic-action/ui/artifact` | A section's grade, A to D, as a chip in its color, the letter alone, and the grade type | [#grade-chip](https://ui.atelic.me/#grade-chip) |
|
|
42
42
|
| `SignOff`, `WriteupPerson` | `@atelic-action/ui/artifact` | The close a document ends on, and the person it names | [#sign-off](https://ui.atelic.me/#sign-off) |
|
|
43
43
|
| `Shot`, `WriteupShot` | `@atelic-action/ui/artifact` | The owner's own screen, opening the full picture, over its caption; a portrait crop is marked `data-portrait` and held to 200px (1.8in in print) | [#shot](https://ui.atelic.me/#shot) |
|
|
44
|
-
| `Paragraph`, `Runs`, `ArtifactAnchor`, `isEmpty`, `ArtifactLink`, `ArtifactParagraph` | `@atelic-action/ui/artifact` | Plain data text a routine can write as JSON: a paragraph, its runs alone, one link, the empty test, and the
|
|
44
|
+
| `Paragraph`, `Runs`, `ArtifactAnchor`, `isEmpty`, `isQuery`, `ArtifactLink`, `ArtifactQuery`, `ArtifactRun`, `ArtifactParagraph` | `@atelic-action/ui/artifact` | Plain data text a routine can write as JSON: a paragraph, its runs alone, one link, the empty test, the query test, and the four types | [#paragraph](https://ui.atelic.me/#paragraph) |
|
|
45
45
|
| `ArtifactShell` | `@atelic-action/ui/artifact` | The chrome around a document page: skip link, dark header, closing bar, watermark | [#site-header](https://ui.atelic.me/#site-header) (its dark bar) |
|
|
46
46
|
| `AppErrorBoundary`, `ErrorFallback` | `@atelic-action/ui/artifact` | The error boundary and the page it falls back to | none |
|
|
47
47
|
| `buildPageHead`, `canonicalURL`, `newTabProps`, the `ArtifactConfig` types | `@atelic-action/ui/artifact` | A page's head, a link's new tab props, and a site's contract | none |
|
|
@@ -343,7 +343,7 @@ The two pieces a reader sees are ordinary components, in `@atelic-action/ui/comp
|
|
|
343
343
|
|
|
344
344
|
`@atelic-action/ui/artifact` is the pieces an artifact document is built from and the site around it, so a fix to a piece reaches every business's documents with one version bump. The composed documents themselves (`Writeup`, `Read`, `Report`, `Note`, and the sealed `Gate`, with their content types and their stylesheet) live in [`@atelic-action/artifact`](https://github.com/atelic-action/artifact) since 2.0.0, which depends on this package for everything below:
|
|
345
345
|
|
|
346
|
-
- **The pieces:** `GradeChip` and `gradeLabel` with the `WriteupGrade` type, `SignOff` with the `WriteupPerson` type, `Shot` with the `WriteupShot` type (a crop taller than it is wide is measured in the browser, marked `data-portrait`, and held to 200px wide on screen and 1.8in in print; a layout that sizes its shots itself sets `--op-shot-portrait-max: none` to opt out, on screen and in print alike), and the plain data text (`Paragraph`, `Runs`, `ArtifactAnchor`, and `
|
|
346
|
+
- **The pieces:** `GradeChip` and `gradeLabel` with the `WriteupGrade` type, `SignOff` with the `WriteupPerson` type, `Shot` with the `WriteupShot` type (a crop taller than it is wide is measured in the browser, marked `data-portrait`, and held to 200px wide on screen and 1.8in in print; a layout that sizes its shots itself sets `--op-shot-portrait-max: none` to opt out, on screen and in print alike), and the plain data text (`Paragraph`, `Runs`, `ArtifactAnchor`, `isEmpty`, and `isQuery`, with the `ArtifactLink`, `ArtifactQuery`, `ArtifactRun`, and `ArtifactParagraph` types: a paragraph is a string or runs of text, `{ text, href }` links, and `{ query, href? }` search queries, so a routine can write a document as JSON). A query renders as `<em class="query">` around the words in curly quotes, which the component adds, so content passes the bare words; with an `href`, the link sits inside the `em` around the quoted words.
|
|
347
347
|
- **The shell:** `ArtifactShell`, the `.atelic-ui` scope with the skip link, the dark header, the closing bar, and the watermark around a page.
|
|
348
348
|
- **The contract and the head:** the `ArtifactConfig` types, and `buildPageHead` and `canonicalURL` with their `PageMeta` type.
|
|
349
349
|
- **Who opened it:** `whoIsReading`, the email a reader signed in with at the wall, by the form or by the sign in a send carried, and nobody on the sender's own domain. It is also built and exported alone as `@atelic-action/ui/artifact/readers`, because a Playwright spec runs under Node, which compiles nothing inside `node_modules`.
|
|
@@ -476,6 +476,33 @@ export function SiteShell(props: Omit<SiteShellProps, "currentPath" | "basePath"
|
|
|
476
476
|
}
|
|
477
477
|
```
|
|
478
478
|
|
|
479
|
+
### The Default Footer
|
|
480
|
+
|
|
481
|
+
Every site's footer has one shape, and `Footer` draws it (7.0.0):
|
|
482
|
+
|
|
483
|
+
- **The brand column:** the logo, then the Google rating as plain text beside five stars (never a link), then the one address, the headquarters, linked to the business's Google profile, then the phone and the email, each a link.
|
|
484
|
+
- **Four link columns:** Company, Resources, Social, and Legal, in that order. A Social link carries its icon in front of its words. A column with no links is left out, and the grid sizes itself to the columns shown.
|
|
485
|
+
- **The closing bar:** `ClosingBar` under it all, `Copyright` with the business's name on the left and `Credit` on the right.
|
|
486
|
+
|
|
487
|
+
The header carries the services and the service areas, so the footer does not repeat them. It holds no blurb, no hours, no call to action, and no credential badges; a site that needs one of those puts it on a page.
|
|
488
|
+
|
|
489
|
+
`SiteShell` fills the footer from the `SiteConfig`, so a site names nothing twice:
|
|
490
|
+
|
|
491
|
+
| The footer shows | From the config |
|
|
492
|
+
|---|---|
|
|
493
|
+
| The rating | `footer.rating`, as printed (`"4.8 on Google"`) |
|
|
494
|
+
| The address and its link | `address` and `mapLinkURL`; `footer.showAddress: false` drops the address |
|
|
495
|
+
| The phone and the email | `phone`, `email` |
|
|
496
|
+
| Company | `nav` |
|
|
497
|
+
| Resources | `footerLinks` |
|
|
498
|
+
| Social | `socialLinks`, each with its `icon` (`facebook`, `github`, `instagram`, `linkedin`, `mail`, `star`, `user`, `youtube`) |
|
|
499
|
+
| Legal | `legalLinks` |
|
|
500
|
+
| The closing bar's right side | the practice's credit, or `footer.note` in its place |
|
|
501
|
+
|
|
502
|
+
A site whose footer genuinely needs other columns names them outright in `footer.columns`, which replaces the derived four. Rendering `Footer` directly, a site passes `columns` itself.
|
|
503
|
+
|
|
504
|
+
Moving to 7.0.0: `footerBlurb` and `footer.contactHeading` are gone from the config, and `Footer` no longer takes `blurb`, `socialLinks`, `links`, `extraLinks`, `contactHeading`, `hours`, or `legalLinks`. Delete `footerBlurb` from the site config; the rest carries over through the mapping above. The hours stay in the config for the structured data and the page sections that print them.
|
|
505
|
+
|
|
479
506
|
### Every Section
|
|
480
507
|
|
|
481
508
|
| Section | What it is |
|
|
@@ -520,7 +547,7 @@ The primitives that came with them, in `@atelic-action/ui/primitives`: `ImageFra
|
|
|
520
547
|
|
|
521
548
|
The entry also exports the helpers the sections use, for a site's own code: `formatClock`, `formatHoursRange`, and `isClosed` for hours, `isHoneypotFilled`, and `trackEvent`.
|
|
522
549
|
|
|
523
|
-
Hours print on the 12 hour clock unless the site's config sets `clock: "24h"`, which turns "9a to 5p" into "09:00 to 17:00" everywhere hours appear:
|
|
550
|
+
Hours print on the 12 hour clock unless the site's config sets `clock: "24h"`, which turns "9a to 5p" into "09:00 to 17:00" everywhere hours appear: `LocationSection` and `HoursTable` (which takes `clock` as a prop when used on its own). `formatClock` and `formatHoursRange` take the same `clock` option for a site's own code.
|
|
524
551
|
|
|
525
552
|
### The Marketing Vite Config and Commands
|
|
526
553
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Shared UI for the Atelic templates: site chrome, base styles, the component library, the access gate, and the app shell they install",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -2,8 +2,8 @@ import { newTabProps } from "../lib/newTabProps";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Plain data text for the documents in @atelic-action/artifact a routine
|
|
5
|
-
* can write as JSON (the note and the read): a paragraph is a string, or runs of text
|
|
6
|
-
* order. A link opens in a new tab when it leaves the page, and in place
|
|
5
|
+
* can write as JSON (the note and the read): a paragraph is a string, or runs of text,
|
|
6
|
+
* links, and search queries in order. A link opens in a new tab when it leaves the page, and in place
|
|
7
7
|
* when it is an anchor or a mail link.
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -13,8 +13,22 @@ export interface ArtifactLink {
|
|
|
13
13
|
href: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/** A
|
|
17
|
-
export
|
|
16
|
+
/** A search someone types, set the way every document sets one: in curly quotes and italics. With an href, the quoted words are the link. */
|
|
17
|
+
export interface ArtifactQuery {
|
|
18
|
+
query: string;
|
|
19
|
+
href?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** One run of a paragraph: plain text, a link, or a search query. */
|
|
23
|
+
export type ArtifactRun = string | ArtifactLink | ArtifactQuery;
|
|
24
|
+
|
|
25
|
+
/** A paragraph: a plain string, or runs of text, links, and search queries in order. */
|
|
26
|
+
export type ArtifactParagraph = string | Array<ArtifactRun>;
|
|
27
|
+
|
|
28
|
+
/** Whether a run is a search query rather than text or a link. */
|
|
29
|
+
export function isQuery(run: ArtifactRun): run is ArtifactQuery {
|
|
30
|
+
return typeof run !== "string" && "query" in run;
|
|
31
|
+
}
|
|
18
32
|
|
|
19
33
|
/** A link opens in a new tab when it leaves the page, and in place when it is an anchor or a mail link. */
|
|
20
34
|
export function ArtifactAnchor({ href, children }: { href: string; children: string }) {
|
|
@@ -25,27 +39,40 @@ export function ArtifactAnchor({ href, children }: { href: string; children: str
|
|
|
25
39
|
);
|
|
26
40
|
}
|
|
27
41
|
|
|
28
|
-
/** A paragraph with nothing to read: a blank string, or runs that are all blank strings. A link always counts. */
|
|
42
|
+
/** A paragraph with nothing to read: a blank string, or runs that are all blank strings. A link or a query always counts. */
|
|
29
43
|
export function isEmpty(paragraph: ArtifactParagraph): boolean {
|
|
30
44
|
const runs = typeof paragraph === "string" ? [paragraph] : paragraph;
|
|
31
45
|
return runs.every((run) => typeof run === "string" && run.trim() === "");
|
|
32
46
|
}
|
|
33
47
|
|
|
48
|
+
/** A search query in curly quotes and italics; the content passes the bare words and never types the quotes. */
|
|
49
|
+
function Query({ run }: { run: ArtifactQuery }) {
|
|
50
|
+
const quoted = `“${run.query}”`;
|
|
51
|
+
return (
|
|
52
|
+
<em className="query">
|
|
53
|
+
{run.href ? <ArtifactAnchor href={run.href}>{quoted}</ArtifactAnchor> : quoted}
|
|
54
|
+
</em>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
/** The runs alone, for a container that is not a paragraph (a list item, a table cell). */
|
|
35
59
|
export function Runs({ paragraph }: { paragraph: ArtifactParagraph }) {
|
|
36
60
|
const runs = typeof paragraph === "string" ? [paragraph] : paragraph;
|
|
37
61
|
return (
|
|
38
62
|
<>
|
|
39
|
-
{runs.map((run, i) =>
|
|
40
|
-
typeof run === "string"
|
|
41
|
-
|
|
42
|
-
|
|
63
|
+
{runs.map((run, i) => {
|
|
64
|
+
if (typeof run === "string") return run;
|
|
65
|
+
if (isQuery(run)) {
|
|
66
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: runs are static content in a fixed order
|
|
67
|
+
return <Query run={run} key={i} />;
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
43
70
|
// biome-ignore lint/suspicious/noArrayIndexKey: runs are static content in a fixed order
|
|
44
71
|
<ArtifactAnchor href={run.href} key={i}>
|
|
45
72
|
{run.text}
|
|
46
73
|
</ArtifactAnchor>
|
|
47
|
-
)
|
|
48
|
-
)}
|
|
74
|
+
);
|
|
75
|
+
})}
|
|
49
76
|
</>
|
|
50
77
|
);
|
|
51
78
|
}
|
package/src/artifact/index.ts
CHANGED
package/src/chrome/Footer.tsx
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import { Mail, UserRound } from "lucide-react";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
1
|
+
import { Mail, Star, UserRound } from "lucide-react";
|
|
2
|
+
import type { ComponentProps, CSSProperties } from "react";
|
|
3
3
|
import { newTabProps } from "../lib/newTabProps";
|
|
4
|
-
import type {
|
|
5
|
-
Brand,
|
|
6
|
-
HoursRow,
|
|
7
|
-
NavLink,
|
|
8
|
-
Phone,
|
|
9
|
-
PostalAddress,
|
|
10
|
-
SiteLink,
|
|
11
|
-
SocialLink,
|
|
12
|
-
} from "../types";
|
|
4
|
+
import type { Brand, FooterColumn, FooterColumnLink, Phone, PostalAddress } from "../types";
|
|
13
5
|
import { ClosingBar } from "./ClosingBar";
|
|
14
6
|
import { Copyright } from "./Copyright";
|
|
15
7
|
|
|
16
8
|
/*
|
|
17
9
|
* lucide-react ships no brand marks (removed upstream by policy), and a code
|
|
18
10
|
* glyph standing in for GitHub or a briefcase for LinkedIn misleads the
|
|
19
|
-
* reader. These
|
|
11
|
+
* reader. These are the brands' own simple marks, carried by hand as a
|
|
20
12
|
* considered exception to the lucide only rule; like lucide icons they take
|
|
21
13
|
* currentColor and a size prop.
|
|
22
14
|
*/
|
|
@@ -52,64 +44,113 @@ function LinkedInMark({ size = 18, ...rest }: MarkProps) {
|
|
|
52
44
|
);
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
47
|
+
function FacebookMark({ size = 18, ...rest }: MarkProps) {
|
|
48
|
+
return (
|
|
49
|
+
<svg
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
viewBox="0 0 24 24"
|
|
52
|
+
width={size}
|
|
53
|
+
height={size}
|
|
54
|
+
fill="none"
|
|
55
|
+
stroke="currentColor"
|
|
56
|
+
strokeWidth={1.75}
|
|
57
|
+
strokeLinecap="round"
|
|
58
|
+
strokeLinejoin="round"
|
|
59
|
+
{...rest}
|
|
60
|
+
>
|
|
61
|
+
<path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z" />
|
|
62
|
+
</svg>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
61
65
|
|
|
62
|
-
function
|
|
63
|
-
const Icon = SOCIAL_ICONS[link.icon];
|
|
66
|
+
function InstagramMark({ size = 18, ...rest }: MarkProps) {
|
|
64
67
|
return (
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
<svg
|
|
69
|
+
aria-hidden="true"
|
|
70
|
+
viewBox="0 0 24 24"
|
|
71
|
+
width={size}
|
|
72
|
+
height={size}
|
|
73
|
+
fill="none"
|
|
74
|
+
stroke="currentColor"
|
|
75
|
+
strokeWidth={1.75}
|
|
76
|
+
strokeLinecap="round"
|
|
77
|
+
strokeLinejoin="round"
|
|
78
|
+
{...rest}
|
|
71
79
|
>
|
|
72
|
-
<
|
|
73
|
-
</
|
|
80
|
+
<path d="M7 2h10a5 5 0 0 1 5 5v10a5 5 0 0 1-5 5H7a5 5 0 0 1-5-5V7a5 5 0 0 1 5-5z M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z M17.5 6.5h.01" />
|
|
81
|
+
</svg>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function YouTubeMark({ size = 18, ...rest }: MarkProps) {
|
|
86
|
+
return (
|
|
87
|
+
<svg
|
|
88
|
+
aria-hidden="true"
|
|
89
|
+
viewBox="0 0 24 24"
|
|
90
|
+
width={size}
|
|
91
|
+
height={size}
|
|
92
|
+
fill="none"
|
|
93
|
+
stroke="currentColor"
|
|
94
|
+
strokeWidth={1.75}
|
|
95
|
+
strokeLinecap="round"
|
|
96
|
+
strokeLinejoin="round"
|
|
97
|
+
{...rest}
|
|
98
|
+
>
|
|
99
|
+
<path d="M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17 M10 15l5-3-5-3z" />
|
|
100
|
+
</svg>
|
|
74
101
|
);
|
|
75
102
|
}
|
|
76
103
|
|
|
77
|
-
|
|
104
|
+
const LINK_ICONS = {
|
|
105
|
+
facebook: FacebookMark,
|
|
106
|
+
github: GitHubMark,
|
|
107
|
+
instagram: InstagramMark,
|
|
108
|
+
linkedin: LinkedInMark,
|
|
109
|
+
mail: Mail,
|
|
110
|
+
star: Star,
|
|
111
|
+
user: UserRound,
|
|
112
|
+
youtube: YouTubeMark,
|
|
113
|
+
} as const;
|
|
114
|
+
|
|
115
|
+
function ColumnLink({ link }: { link: FooterColumnLink }) {
|
|
116
|
+
const Icon = link.icon ? LINK_ICONS[link.icon] : null;
|
|
78
117
|
return (
|
|
79
118
|
<a href={link.href} {...newTabProps(link.href, link.external)}>
|
|
119
|
+
{Icon && <Icon aria-hidden size={18} />}
|
|
80
120
|
{link.label}
|
|
81
121
|
</a>
|
|
82
122
|
);
|
|
83
123
|
}
|
|
84
124
|
|
|
125
|
+
const STARS = [1, 2, 3, 4, 5];
|
|
126
|
+
|
|
85
127
|
export interface FooterProps {
|
|
86
128
|
/** The identity at the head of the brand column. */
|
|
87
129
|
brand: Brand;
|
|
88
|
-
/** Short brand paragraph under the identity. */
|
|
89
|
-
blurb?: string;
|
|
90
|
-
/** Icon links (socials, the founder's own site) under the blurb. */
|
|
91
|
-
socialLinks?: SocialLink[];
|
|
92
|
-
/** The site's nav, repeated in the explore column. */
|
|
93
|
-
links?: NavLink[];
|
|
94
|
-
/** Explore links beyond the nav, e.g. a patient portal. */
|
|
95
|
-
extraLinks?: SiteLink[];
|
|
96
|
-
/** Heading over the contact column. Defaults to "Visit". */
|
|
97
|
-
contactHeading?: string;
|
|
98
130
|
/**
|
|
99
|
-
* The
|
|
100
|
-
*
|
|
101
|
-
|
|
131
|
+
* The Google rating as printed, e.g. "4.8 on Google". It sits under the
|
|
132
|
+
* logo beside five stars, as plain text and never a link.
|
|
133
|
+
*/
|
|
134
|
+
rating?: string;
|
|
135
|
+
/**
|
|
136
|
+
* The one address, the headquarters. Omit it for a business with no
|
|
137
|
+
* storefront, and the phone and email stand alone.
|
|
102
138
|
*/
|
|
103
139
|
address?: PostalAddress;
|
|
140
|
+
/** Where the address links: the business's Google profile. */
|
|
141
|
+
addressHref?: string;
|
|
104
142
|
phone?: Phone;
|
|
105
143
|
email?: string;
|
|
106
|
-
/**
|
|
107
|
-
|
|
144
|
+
/**
|
|
145
|
+
* The link columns beside the brand column. The default footer carries
|
|
146
|
+
* four: Company, Resources, Social, and Legal. A column with no links is
|
|
147
|
+
* left out.
|
|
148
|
+
*/
|
|
149
|
+
columns?: FooterColumn[];
|
|
108
150
|
/** Suffix on the copyright line, e.g. "Dr. Alex Rivers, PT, DPT". */
|
|
109
151
|
attribution?: string;
|
|
110
152
|
/** The site's own words for the closing bar's right side, in place of the practice's credit. */
|
|
111
153
|
note?: string;
|
|
112
|
-
legalLinks?: SiteLink[];
|
|
113
154
|
/**
|
|
114
155
|
* The practice's credit on the closing bar's right side. Defaults on; off
|
|
115
156
|
* leaves the right side empty unless the site gives a note. The copyright
|
|
@@ -118,31 +159,46 @@ export interface FooterProps {
|
|
|
118
159
|
credit?: boolean;
|
|
119
160
|
}
|
|
120
161
|
|
|
121
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* The site footer: a brand column (the logo, the Google rating, the address
|
|
164
|
+
* linked to the Google profile, the phone, and the email), the link columns
|
|
165
|
+
* beside it, and the closing bar under it all.
|
|
166
|
+
*/
|
|
122
167
|
export function Footer({
|
|
123
168
|
brand,
|
|
124
|
-
|
|
125
|
-
socialLinks,
|
|
126
|
-
links,
|
|
127
|
-
extraLinks,
|
|
128
|
-
contactHeading = "Visit",
|
|
169
|
+
rating,
|
|
129
170
|
address,
|
|
171
|
+
addressHref,
|
|
130
172
|
phone,
|
|
131
173
|
email,
|
|
132
|
-
|
|
174
|
+
columns,
|
|
133
175
|
attribution,
|
|
134
176
|
note,
|
|
135
|
-
legalLinks,
|
|
136
177
|
credit = true,
|
|
137
178
|
}: FooterProps) {
|
|
138
179
|
const { name, logo } = brand;
|
|
139
180
|
const wordmark = logo?.wordmark ?? name;
|
|
181
|
+
const shown = (columns ?? []).filter((column) => column.links.length > 0);
|
|
182
|
+
const addressLines = address && (
|
|
183
|
+
<>
|
|
184
|
+
{/* A business that publishes a service area but no storefront leaves
|
|
185
|
+
street empty; a blank line reads as a broken block. */}
|
|
186
|
+
{address.street && <span>{address.street}</span>}
|
|
187
|
+
<span>
|
|
188
|
+
{address.locality}, {address.region}
|
|
189
|
+
{address.postalCode ? ` ${address.postalCode}` : ""}
|
|
190
|
+
</span>
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
140
193
|
|
|
141
194
|
return (
|
|
142
195
|
<>
|
|
143
196
|
<footer className="footer">
|
|
144
197
|
<div className="wrap">
|
|
145
|
-
<div
|
|
198
|
+
<div
|
|
199
|
+
className="footer-grid"
|
|
200
|
+
style={{ "--footer-columns": shown.length } as CSSProperties}
|
|
201
|
+
>
|
|
146
202
|
<div className="footer-brand">
|
|
147
203
|
{logo?.tile ? (
|
|
148
204
|
<p className="footer-wordmark">
|
|
@@ -160,79 +216,44 @@ export function Footer({
|
|
|
160
216
|
{logo?.run && <span className="wordmark-run" aria-hidden="true" />}
|
|
161
217
|
</p>
|
|
162
218
|
)}
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
219
|
+
{rating && (
|
|
220
|
+
<p className="footer-rating">
|
|
221
|
+
<span className="footer-stars" aria-hidden="true">
|
|
222
|
+
{STARS.map((star) => (
|
|
223
|
+
<Star key={star} size={16} fill="currentColor" />
|
|
224
|
+
))}
|
|
225
|
+
</span>
|
|
226
|
+
{rating}
|
|
227
|
+
</p>
|
|
228
|
+
)}
|
|
229
|
+
{(address || phone || email) && (
|
|
230
|
+
<address className="nap">
|
|
231
|
+
{address &&
|
|
232
|
+
(addressHref ? (
|
|
233
|
+
<a
|
|
234
|
+
className="nap-address"
|
|
235
|
+
href={addressHref}
|
|
236
|
+
{...newTabProps(addressHref, true)}
|
|
237
|
+
>
|
|
238
|
+
{addressLines}
|
|
239
|
+
</a>
|
|
240
|
+
) : (
|
|
241
|
+
<span className="nap-address">{addressLines}</span>
|
|
242
|
+
))}
|
|
243
|
+
{phone && <a href={`tel:${phone.e164}`}>{phone.display}</a>}
|
|
244
|
+
{email && <a href={`mailto:${email}`}>{email}</a>}
|
|
245
|
+
</address>
|
|
170
246
|
)}
|
|
171
247
|
</div>
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
{links
|
|
176
|
-
<
|
|
177
|
-
{link.label}
|
|
178
|
-
</a>
|
|
179
|
-
))}
|
|
180
|
-
{extraLinks?.map((link) => (
|
|
181
|
-
<FooterLink key={link.href} link={link} />
|
|
248
|
+
{shown.map((column) => (
|
|
249
|
+
<nav key={column.heading} className="footer-column" aria-label={column.heading}>
|
|
250
|
+
<h4>{column.heading}</h4>
|
|
251
|
+
{column.links.map((link) => (
|
|
252
|
+
<ColumnLink key={`${link.label} ${link.href}`} link={link} />
|
|
182
253
|
))}
|
|
183
254
|
</nav>
|
|
184
|
-
|
|
185
|
-
<div>
|
|
186
|
-
<h4>{contactHeading}</h4>
|
|
187
|
-
<address className="nap">
|
|
188
|
-
{address && (
|
|
189
|
-
<>
|
|
190
|
-
<strong>{name}</strong>
|
|
191
|
-
<br />
|
|
192
|
-
{/* A business that publishes a service area but no storefront
|
|
193
|
-
leaves street empty; a blank line reads as a broken block. */}
|
|
194
|
-
{address.street && (
|
|
195
|
-
<>
|
|
196
|
-
{address.street}
|
|
197
|
-
<br />
|
|
198
|
-
</>
|
|
199
|
-
)}
|
|
200
|
-
{address.locality}, {address.region}
|
|
201
|
-
{address.postalCode ? ` ${address.postalCode}` : ""}
|
|
202
|
-
<br />
|
|
203
|
-
<br />
|
|
204
|
-
</>
|
|
205
|
-
)}
|
|
206
|
-
{phone && (
|
|
207
|
-
<>
|
|
208
|
-
<a href={`tel:${phone.e164}`}>{phone.display}</a>
|
|
209
|
-
<br />
|
|
210
|
-
</>
|
|
211
|
-
)}
|
|
212
|
-
{email && <a href={`mailto:${email}`}>{email}</a>}
|
|
213
|
-
</address>
|
|
214
|
-
</div>
|
|
215
|
-
{hours && hours.length > 0 && (
|
|
216
|
-
<div>
|
|
217
|
-
<h4>Hours</h4>
|
|
218
|
-
<div className="footer-hours">
|
|
219
|
-
{hours.map((row) => (
|
|
220
|
-
<span key={row.label}>
|
|
221
|
-
{row.label} {row.range}
|
|
222
|
-
<br />
|
|
223
|
-
</span>
|
|
224
|
-
))}
|
|
225
|
-
</div>
|
|
226
|
-
</div>
|
|
227
|
-
)}
|
|
255
|
+
))}
|
|
228
256
|
</div>
|
|
229
|
-
{legalLinks && legalLinks.length > 0 && (
|
|
230
|
-
<div className="footer-legal">
|
|
231
|
-
{legalLinks.map((link) => (
|
|
232
|
-
<FooterLink key={link.href} link={link} />
|
|
233
|
-
))}
|
|
234
|
-
</div>
|
|
235
|
-
)}
|
|
236
257
|
</div>
|
|
237
258
|
</footer>
|
|
238
259
|
<ClosingBar
|
package/src/chrome/SiteShell.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { Watermark } from "../components/Watermark";
|
|
3
3
|
import type { PageStop } from "../hooks/useScrollSpy";
|
|
4
|
-
import { formatHoursRange } from "../lib/hours";
|
|
5
4
|
import { BasePathProvider } from "../routing/BasePathProvider";
|
|
6
5
|
import { joinBase, normalizeBasePath, stripBase } from "../routing/basePath";
|
|
7
6
|
import type { NavItem, SiteConfig } from "../sections/siteConfig";
|
|
7
|
+
import type { FooterColumn } from "../types";
|
|
8
8
|
import { ClosingBar } from "./ClosingBar";
|
|
9
9
|
import { Copyright } from "./Copyright";
|
|
10
10
|
import { Footer } from "./Footer";
|
|
@@ -96,6 +96,20 @@ export function SiteShell({
|
|
|
96
96
|
const cta = { ...site.cta, href: withBase(site.cta.href) };
|
|
97
97
|
const based = <T extends { href: string }>(items: T[] | undefined) =>
|
|
98
98
|
items?.map((item) => ({ ...item, href: withBase(item.href) }));
|
|
99
|
+
// The default footer's four columns, drawn from what the config already
|
|
100
|
+
// holds; a site that wants other columns names them in `footer.columns`.
|
|
101
|
+
const footerColumns: FooterColumn[] = site.footer?.columns?.map((column) => ({
|
|
102
|
+
...column,
|
|
103
|
+
links: based(column.links) ?? [],
|
|
104
|
+
})) ?? [
|
|
105
|
+
{ heading: "Company", links },
|
|
106
|
+
{ heading: "Resources", links: based(site.footerLinks) ?? [] },
|
|
107
|
+
{
|
|
108
|
+
heading: "Social",
|
|
109
|
+
links: (based(site.socialLinks) ?? []).map((link) => ({ ...link, external: true })),
|
|
110
|
+
},
|
|
111
|
+
{ heading: "Legal", links: based(site.legalLinks) ?? [] },
|
|
112
|
+
];
|
|
99
113
|
// The header takes one variant. A hero page wins over a dark one: the bar
|
|
100
114
|
// sits transparent over the hero either way, and only its scrolled state
|
|
101
115
|
// differed.
|
|
@@ -124,21 +138,14 @@ export function SiteShell({
|
|
|
124
138
|
{footer ? (
|
|
125
139
|
<Footer
|
|
126
140
|
brand={brand}
|
|
127
|
-
|
|
128
|
-
socialLinks={based(site.socialLinks)}
|
|
129
|
-
links={links}
|
|
130
|
-
extraLinks={based(site.footerLinks)}
|
|
131
|
-
contactHeading={site.footer?.contactHeading}
|
|
141
|
+
rating={site.footer?.rating}
|
|
132
142
|
address={site.footer?.showAddress === false ? undefined : site.address}
|
|
143
|
+
addressHref={site.mapLinkURL}
|
|
133
144
|
phone={site.phone}
|
|
134
145
|
email={site.email}
|
|
135
|
-
|
|
136
|
-
label: row.labelShort,
|
|
137
|
-
range: formatHoursRange(row, { short: true, clock: site.clock }),
|
|
138
|
-
}))}
|
|
146
|
+
columns={footerColumns}
|
|
139
147
|
attribution={site.attribution}
|
|
140
148
|
note={site.footer?.note}
|
|
141
|
-
legalLinks={based(site.legalLinks)}
|
|
142
149
|
credit={credit}
|
|
143
150
|
/>
|
|
144
151
|
) : (
|
package/src/chrome/index.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* render from it, so standing up a new site means writing one of these plus
|
|
9
9
|
* a theme.css, never touching the components themselves.
|
|
10
10
|
*/
|
|
11
|
-
import type { SiteLink, SocialLink } from "../types";
|
|
11
|
+
import type { FooterColumn, SiteLink, SocialLink } from "../types";
|
|
12
12
|
|
|
13
13
|
export type { SiteLink, SocialLink };
|
|
14
14
|
|
|
@@ -156,28 +156,32 @@ export interface SiteConfig {
|
|
|
156
156
|
founder?: Founder;
|
|
157
157
|
/** Names of offered services for structured data. */
|
|
158
158
|
offers?: string[];
|
|
159
|
-
/**
|
|
160
|
-
footerBlurb: string;
|
|
161
|
-
/** Extra footer nav links beyond the main nav (e.g. a patient portal). */
|
|
159
|
+
/** The footer's Resources column (guides, financing, a patient portal). */
|
|
162
160
|
footerLinks?: SiteLink[];
|
|
163
|
-
/**
|
|
161
|
+
/** The footer's Social column, each link printed with its icon. */
|
|
164
162
|
socialLinks?: SocialLink[];
|
|
163
|
+
/** The footer's Legal column. */
|
|
165
164
|
legalLinks?: SiteLink[];
|
|
166
165
|
/** Copyright attribution line suffix, e.g. "Dr. Alex Rivers, PT, DPT". */
|
|
167
166
|
attribution?: string;
|
|
168
167
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
168
|
+
* What the footer needs beyond the fields above. The default footer is a
|
|
169
|
+
* brand column (the logo, the rating, `address` linked to `mapLinkURL`,
|
|
170
|
+
* `phone`, `email`) and four link columns: Company from `nav`, Resources
|
|
171
|
+
* from `footerLinks`, Social from `socialLinks`, and Legal from
|
|
172
|
+
* `legalLinks`.
|
|
173
173
|
*/
|
|
174
174
|
footer?: {
|
|
175
|
-
|
|
175
|
+
/** The Google rating as printed, e.g. "4.8 on Google". Plain text, never a link. */
|
|
176
|
+
rating?: string;
|
|
177
|
+
/** The link columns, named outright, in place of the four the config derives. */
|
|
178
|
+
columns?: FooterColumn[];
|
|
179
|
+
/** The site's own words for the closing bar's right side, in place of the practice's credit. */
|
|
176
180
|
note?: string;
|
|
177
181
|
/**
|
|
178
|
-
* Set false to drop the
|
|
179
|
-
*
|
|
180
|
-
*
|
|
182
|
+
* Set false to drop the address from the brand column and leave only
|
|
183
|
+
* the phone and email (a practice with no storefront has nothing to
|
|
184
|
+
* visit). Defaults to true.
|
|
181
185
|
*/
|
|
182
186
|
showAddress?: boolean;
|
|
183
187
|
};
|
package/src/styles/chrome.css
CHANGED
|
@@ -370,83 +370,79 @@
|
|
|
370
370
|
.atelic-ui .footer a:hover {
|
|
371
371
|
color: #fff;
|
|
372
372
|
}
|
|
373
|
+
/* One grid: the brand column, then the link columns, however many the
|
|
374
|
+
footer was given. A phone stacks the brand column over two across. */
|
|
373
375
|
.atelic-ui .footer-grid {
|
|
374
376
|
display: grid;
|
|
375
|
-
gap: 40px;
|
|
376
|
-
grid-template-columns: 1fr;
|
|
377
|
+
gap: 40px 32px;
|
|
378
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
379
|
+
}
|
|
380
|
+
.atelic-ui .footer-brand {
|
|
381
|
+
grid-column: 1 / -1;
|
|
377
382
|
}
|
|
378
383
|
.atelic-ui .footer h4 {
|
|
379
384
|
color: #fff;
|
|
380
385
|
font-family: var(--font-mono);
|
|
381
|
-
font-size: 0.
|
|
382
|
-
letter-spacing: 0.
|
|
386
|
+
font-size: 0.84rem;
|
|
387
|
+
letter-spacing: 0.1em;
|
|
383
388
|
text-transform: uppercase;
|
|
384
|
-
font-weight:
|
|
385
|
-
margin-bottom:
|
|
389
|
+
font-weight: 700;
|
|
390
|
+
margin-bottom: 14px;
|
|
386
391
|
}
|
|
387
392
|
.atelic-ui .footer-brand img {
|
|
388
393
|
height: 38px;
|
|
389
394
|
margin-bottom: 18px;
|
|
390
395
|
}
|
|
391
|
-
.atelic-ui .footer-
|
|
392
|
-
|
|
393
|
-
|
|
396
|
+
.atelic-ui .footer-rating {
|
|
397
|
+
display: flex;
|
|
398
|
+
align-items: center;
|
|
399
|
+
gap: 10px;
|
|
400
|
+
color: #fff;
|
|
401
|
+
font-weight: 500;
|
|
402
|
+
margin-bottom: 10px;
|
|
403
|
+
}
|
|
404
|
+
.atelic-ui .footer-stars {
|
|
405
|
+
display: inline-flex;
|
|
406
|
+
gap: 2px;
|
|
407
|
+
color: #f5b301;
|
|
394
408
|
}
|
|
395
409
|
.atelic-ui .footer nav a {
|
|
396
|
-
display:
|
|
410
|
+
display: flex;
|
|
411
|
+
align-items: center;
|
|
412
|
+
gap: 10px;
|
|
397
413
|
padding: 6px 0;
|
|
398
414
|
color: var(--neutral-200);
|
|
399
415
|
font-weight: 500;
|
|
400
416
|
}
|
|
417
|
+
.atelic-ui .footer nav a svg {
|
|
418
|
+
flex: none;
|
|
419
|
+
}
|
|
401
420
|
.atelic-ui .footer .nap {
|
|
421
|
+
display: flex;
|
|
422
|
+
flex-direction: column;
|
|
423
|
+
align-items: flex-start;
|
|
424
|
+
gap: 6px;
|
|
402
425
|
font-style: normal;
|
|
403
|
-
line-height: 1.9;
|
|
404
426
|
color: var(--neutral-200);
|
|
405
427
|
}
|
|
406
428
|
.atelic-ui .footer .nap a {
|
|
407
429
|
color: #fff;
|
|
408
430
|
font-weight: 600;
|
|
409
431
|
}
|
|
410
|
-
.atelic-ui .footer-
|
|
411
|
-
|
|
412
|
-
font-size: 0.82rem;
|
|
413
|
-
line-height: 1.9;
|
|
414
|
-
color: var(--neutral-300);
|
|
415
|
-
}
|
|
416
|
-
.atelic-ui .footer-social {
|
|
417
|
-
display: flex;
|
|
418
|
-
gap: 10px;
|
|
419
|
-
margin-top: 20px;
|
|
420
|
-
}
|
|
421
|
-
.atelic-ui .footer .footer-social-link {
|
|
422
|
-
display: inline-flex;
|
|
423
|
-
align-items: center;
|
|
424
|
-
justify-content: center;
|
|
425
|
-
width: 38px;
|
|
426
|
-
height: 38px;
|
|
427
|
-
border: 1px solid rgba(255, 255, 255, 0.16);
|
|
428
|
-
border-radius: var(--radius-sm);
|
|
429
|
-
color: var(--neutral-300);
|
|
430
|
-
}
|
|
431
|
-
.atelic-ui .footer .footer-social-link:hover {
|
|
432
|
-
color: var(--primary-bright);
|
|
433
|
-
border-color: var(--primary-bright);
|
|
432
|
+
.atelic-ui .footer-grid > * {
|
|
433
|
+
overflow-wrap: anywhere;
|
|
434
434
|
}
|
|
435
|
-
.atelic-ui .footer-
|
|
436
|
-
margin-top: 48px;
|
|
435
|
+
.atelic-ui .footer .nap-address {
|
|
437
436
|
display: flex;
|
|
438
|
-
|
|
439
|
-
flex-wrap: wrap;
|
|
440
|
-
justify-content: flex-end;
|
|
441
|
-
font-size: 0.82rem;
|
|
442
|
-
}
|
|
443
|
-
.atelic-ui .footer .footer-legal a {
|
|
444
|
-
color: var(--neutral-300);
|
|
437
|
+
flex-direction: column;
|
|
445
438
|
}
|
|
446
439
|
@media (min-width: 760px) {
|
|
447
440
|
.atelic-ui .footer-grid {
|
|
448
|
-
grid-template-columns: 1.4fr
|
|
449
|
-
gap: 48px;
|
|
441
|
+
grid-template-columns: minmax(0, 1.4fr) repeat(var(--footer-columns, 4), minmax(0, 1fr));
|
|
442
|
+
gap: 48px 32px;
|
|
443
|
+
}
|
|
444
|
+
.atelic-ui .footer-brand {
|
|
445
|
+
grid-column: auto;
|
|
450
446
|
}
|
|
451
447
|
}
|
|
452
448
|
/* Text wordmark for a site with no mark image. */
|
package/src/types.ts
CHANGED
|
@@ -63,12 +63,34 @@ export interface SiteLink {
|
|
|
63
63
|
external?: boolean;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/**
|
|
66
|
+
/** The icons a footer link can carry. */
|
|
67
|
+
export type FooterIcon =
|
|
68
|
+
| "facebook"
|
|
69
|
+
| "github"
|
|
70
|
+
| "instagram"
|
|
71
|
+
| "linkedin"
|
|
72
|
+
| "mail"
|
|
73
|
+
| "star"
|
|
74
|
+
| "user"
|
|
75
|
+
| "youtube";
|
|
76
|
+
|
|
77
|
+
/** A social link; the footer's Social column prints it with its icon. */
|
|
67
78
|
export interface SocialLink {
|
|
68
|
-
/**
|
|
79
|
+
/** The link's words, e.g. "GitHub". */
|
|
69
80
|
label: string;
|
|
70
81
|
href: string;
|
|
71
|
-
icon:
|
|
82
|
+
icon: FooterIcon;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** One link in a footer column, with an icon in front when it names one. */
|
|
86
|
+
export interface FooterColumnLink extends SiteLink {
|
|
87
|
+
icon?: FooterIcon;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** One link column of the footer, under its heading. */
|
|
91
|
+
export interface FooterColumn {
|
|
92
|
+
heading: string;
|
|
93
|
+
links: FooterColumnLink[];
|
|
72
94
|
}
|
|
73
95
|
|
|
74
96
|
export interface Phone {
|