@atelic-action/ui 3.12.1 → 3.12.2
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 +1 -1
- package/package.json +1 -1
- package/src/chrome/SiteShell.tsx +3 -1
- package/src/chrome/StickyCTABar.tsx +16 -3
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
|
|
|
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
15
|
| `Footer` | `@atelic-action/ui/chrome` | The site's foot: brand column, nav, address, hours, copyright, credit band | [#footer](https://ui.atelic.me/#footer) |
|
|
16
16
|
| `CreditBar` | `@atelic-action/ui/chrome` | The developer credit band | [#credit-bar](https://ui.atelic.me/#credit-bar) |
|
|
17
|
-
| `StickyCTABar` | `@atelic-action/ui/chrome` | The phone's bottom bar: the call to action and a call shortcut | [#sticky-cta-bar](https://ui.atelic.me/#sticky-cta-bar) |
|
|
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
20
|
| `Brand`, `BrandLogo`, `CallToAction`, `HoursRow`, `MenuContact`, `NavLink`, `Phone`, `PostalAddress`, `SiteLink`, `SocialLink`, `PageStop` | `@atelic-action/ui/chrome` | The shapes the chrome renders from (types) | none |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.2",
|
|
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",
|
package/src/chrome/SiteShell.tsx
CHANGED
|
@@ -116,7 +116,9 @@ export function SiteShell({
|
|
|
116
116
|
<main id="main" className={heroNav ? undefined : "clears-nav"}>
|
|
117
117
|
{children}
|
|
118
118
|
</main>
|
|
119
|
-
{
|
|
119
|
+
{/* An interior page's first screen has no booking button of its own, so
|
|
120
|
+
the bar is there from the top; the hero home page keeps the slide in. */}
|
|
121
|
+
{stickyCTA && <StickyCTABar primaryCTA={cta} phone={site.phone} fromTop={!heroNav} />}
|
|
120
122
|
{footer ? (
|
|
121
123
|
<Footer
|
|
122
124
|
brand={brand}
|
|
@@ -10,25 +10,38 @@ export interface StickyCTABarProps {
|
|
|
10
10
|
phone?: Phone;
|
|
11
11
|
/** Scroll depth in pixels before the bar slides in. Defaults to 520. */
|
|
12
12
|
threshold?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Show the bar from the first paint, with no scroll. For a page whose
|
|
15
|
+
* first screen carries no booking button of its own (every page but the
|
|
16
|
+
* hero home page), so a lead action is one tap away before anyone scrolls.
|
|
17
|
+
* The home page keeps the slide in, since its hero already holds the button
|
|
18
|
+
* and a bar from the top would put two of them on one screen.
|
|
19
|
+
*/
|
|
20
|
+
fromTop?: boolean;
|
|
13
21
|
/** The call shortcut's accessible name. Defaults to "Call us". */
|
|
14
22
|
callLabel?: string;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
|
-
/** The phone only bottom bar: the primary CTA and a call shortcut, sliding in once scrolled. */
|
|
25
|
+
/** The phone only bottom bar: the primary CTA and a call shortcut, sliding in once scrolled, or there from the top. */
|
|
18
26
|
export function StickyCTABar({
|
|
19
27
|
primaryCTA,
|
|
20
28
|
phone,
|
|
21
29
|
threshold = 520,
|
|
30
|
+
fromTop = false,
|
|
22
31
|
callLabel = "Call us",
|
|
23
32
|
}: StickyCTABarProps) {
|
|
24
|
-
const [show, setShow] = useState(
|
|
33
|
+
const [show, setShow] = useState(fromTop);
|
|
25
34
|
|
|
26
35
|
useEffect(() => {
|
|
36
|
+
if (fromTop) {
|
|
37
|
+
setShow(true);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
27
40
|
const onScroll = () => setShow(window.scrollY > threshold);
|
|
28
41
|
window.addEventListener("scroll", onScroll, { passive: true });
|
|
29
42
|
onScroll();
|
|
30
43
|
return () => window.removeEventListener("scroll", onScroll);
|
|
31
|
-
}, [threshold]);
|
|
44
|
+
}, [threshold, fromTop]);
|
|
32
45
|
|
|
33
46
|
return (
|
|
34
47
|
// Inert while offscreen, so its links take no keyboard focus before it slides in.
|