@lets-ship/site 3.3.0 → 3.5.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/dist/i18n/tables/de.d.ts.map +1 -1
- package/dist/i18n/tables/de.js +23 -0
- package/dist/i18n/tables/de.js.map +1 -1
- package/dist/i18n/tables/en.d.ts.map +1 -1
- package/dist/i18n/tables/en.js +23 -0
- package/dist/i18n/tables/en.js.map +1 -1
- package/dist/i18n/tables/es.d.ts.map +1 -1
- package/dist/i18n/tables/es.js +23 -0
- package/dist/i18n/tables/es.js.map +1 -1
- package/dist/i18n/tables/fr.d.ts.map +1 -1
- package/dist/i18n/tables/fr.js +23 -0
- package/dist/i18n/tables/fr.js.map +1 -1
- package/dist/i18n/tables/nl.d.ts.map +1 -1
- package/dist/i18n/tables/nl.js +23 -0
- package/dist/i18n/tables/nl.js.map +1 -1
- package/dist/i18n/tables/pt.d.ts.map +1 -1
- package/dist/i18n/tables/pt.js +23 -0
- package/dist/i18n/tables/pt.js.map +1 -1
- package/dist/i18n/tables/tr.d.ts.map +1 -1
- package/dist/i18n/tables/tr.js +23 -0
- package/dist/i18n/tables/tr.js.map +1 -1
- package/dist/i18n/types.d.ts +29 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/mdx/allow-list.d.ts +1 -1
- package/dist/mdx/allow-list.d.ts.map +1 -1
- package/dist/mdx/allow-list.js +4 -0
- package/dist/mdx/allow-list.js.map +1 -1
- package/dist/mdx/components.d.ts.map +1 -1
- package/dist/mdx/components.js +8 -2
- package/dist/mdx/components.js.map +1 -1
- package/dist/website/blocks/app-views.d.ts +32 -0
- package/dist/website/blocks/app-views.d.ts.map +1 -0
- package/dist/website/blocks/app-views.js +42 -0
- package/dist/website/blocks/app-views.js.map +1 -0
- package/dist/website/blocks/app.d.ts +7 -0
- package/dist/website/blocks/app.d.ts.map +1 -0
- package/dist/website/blocks/app.js +7 -0
- package/dist/website/blocks/app.js.map +1 -0
- package/dist/website/blocks/booking-fields.d.ts +39 -0
- package/dist/website/blocks/booking-fields.d.ts.map +1 -0
- package/dist/website/blocks/booking-fields.js +44 -0
- package/dist/website/blocks/booking-fields.js.map +1 -0
- package/dist/website/blocks/booking-request.d.ts +22 -0
- package/dist/website/blocks/booking-request.d.ts.map +1 -0
- package/dist/website/blocks/booking-request.js +42 -0
- package/dist/website/blocks/booking-request.js.map +1 -0
- package/dist/website/blocks/booking-slot-picker.d.ts +23 -0
- package/dist/website/blocks/booking-slot-picker.d.ts.map +1 -0
- package/dist/website/blocks/booking-slot-picker.js +63 -0
- package/dist/website/blocks/booking-slot-picker.js.map +1 -0
- package/dist/website/blocks/booking-slots.d.ts +63 -0
- package/dist/website/blocks/booking-slots.d.ts.map +1 -0
- package/dist/website/blocks/booking-slots.js +127 -0
- package/dist/website/blocks/booking-slots.js.map +1 -0
- package/dist/website/blocks/booking-views.d.ts +42 -0
- package/dist/website/blocks/booking-views.d.ts.map +1 -0
- package/dist/website/blocks/booking-views.js +52 -0
- package/dist/website/blocks/booking-views.js.map +1 -0
- package/dist/website/blocks/call-to-action-views.d.ts.map +1 -1
- package/dist/website/blocks/call-to-action-views.js +1 -1
- package/dist/website/blocks/call-to-action-views.js.map +1 -1
- package/dist/website/blocks/card-grid-views.d.ts +5 -4
- package/dist/website/blocks/card-grid-views.d.ts.map +1 -1
- package/dist/website/blocks/card-grid-views.js +15 -3
- package/dist/website/blocks/card-grid-views.js.map +1 -1
- package/dist/website/blocks/catalog.d.ts +6 -2
- package/dist/website/blocks/catalog.d.ts.map +1 -1
- package/dist/website/blocks/catalog.js +6 -2
- package/dist/website/blocks/catalog.js.map +1 -1
- package/dist/website/blocks/commerce.d.ts.map +1 -1
- package/dist/website/blocks/commerce.js +2 -1
- package/dist/website/blocks/commerce.js.map +1 -1
- package/dist/website/blocks/contact-views.d.ts.map +1 -1
- package/dist/website/blocks/contact-views.js +7 -4
- package/dist/website/blocks/contact-views.js.map +1 -1
- package/dist/website/blocks/empty-state-views.d.ts.map +1 -1
- package/dist/website/blocks/empty-state-views.js +1 -1
- package/dist/website/blocks/empty-state-views.js.map +1 -1
- package/dist/website/blocks/event-dates.d.ts +42 -0
- package/dist/website/blocks/event-dates.d.ts.map +1 -0
- package/dist/website/blocks/event-dates.js +80 -0
- package/dist/website/blocks/event-dates.js.map +1 -0
- package/dist/website/blocks/event-list.d.ts +16 -0
- package/dist/website/blocks/event-list.d.ts.map +1 -0
- package/dist/website/blocks/event-list.js +37 -0
- package/dist/website/blocks/event-list.js.map +1 -0
- package/dist/website/blocks/event-rows.d.ts +9 -0
- package/dist/website/blocks/event-rows.d.ts.map +1 -0
- package/dist/website/blocks/event-rows.js +13 -0
- package/dist/website/blocks/event-rows.js.map +1 -0
- package/dist/website/blocks/event-visitor.d.ts +14 -0
- package/dist/website/blocks/event-visitor.d.ts.map +1 -0
- package/dist/website/blocks/event-visitor.js +16 -0
- package/dist/website/blocks/event-visitor.js.map +1 -0
- package/dist/website/blocks/faq-views.d.ts.map +1 -1
- package/dist/website/blocks/faq-views.js +7 -7
- package/dist/website/blocks/faq-views.js.map +1 -1
- package/dist/website/blocks/hero-views.js +1 -1
- package/dist/website/blocks/hero-views.js.map +1 -1
- package/dist/website/blocks/icons.d.ts +2 -0
- package/dist/website/blocks/icons.d.ts.map +1 -1
- package/dist/website/blocks/icons.js +3 -1
- package/dist/website/blocks/icons.js.map +1 -1
- package/dist/website/blocks/local-views.d.ts +27 -2
- package/dist/website/blocks/local-views.d.ts.map +1 -1
- package/dist/website/blocks/local-views.js +20 -5
- package/dist/website/blocks/local-views.js.map +1 -1
- package/dist/website/blocks/local.d.ts +10 -0
- package/dist/website/blocks/local.d.ts.map +1 -1
- package/dist/website/blocks/local.js +10 -0
- package/dist/website/blocks/local.js.map +1 -1
- package/dist/website/blocks/logo-stats-views.d.ts.map +1 -1
- package/dist/website/blocks/logo-stats-views.js +3 -1
- package/dist/website/blocks/logo-stats-views.js.map +1 -1
- package/dist/website/blocks/media-views.js +1 -1
- package/dist/website/blocks/media-views.js.map +1 -1
- package/dist/website/blocks/menu-views.d.ts +44 -0
- package/dist/website/blocks/menu-views.d.ts.map +1 -0
- package/dist/website/blocks/menu-views.js +47 -0
- package/dist/website/blocks/menu-views.js.map +1 -0
- package/dist/website/blocks/newsletter-views.d.ts +3 -2
- package/dist/website/blocks/newsletter-views.d.ts.map +1 -1
- package/dist/website/blocks/newsletter-views.js +15 -27
- package/dist/website/blocks/newsletter-views.js.map +1 -1
- package/dist/website/blocks/products-views.d.ts +38 -0
- package/dist/website/blocks/products-views.d.ts.map +1 -0
- package/dist/website/blocks/products-views.js +65 -0
- package/dist/website/blocks/products-views.js.map +1 -0
- package/dist/website/blocks/shop.d.ts +7 -0
- package/dist/website/blocks/shop.d.ts.map +1 -0
- package/dist/website/blocks/shop.js +7 -0
- package/dist/website/blocks/shop.js.map +1 -0
- package/dist/website/blocks/signup.d.ts +42 -0
- package/dist/website/blocks/signup.d.ts.map +1 -0
- package/dist/website/blocks/signup.js +39 -0
- package/dist/website/blocks/signup.js.map +1 -0
- package/dist/website/blocks/ticks.d.ts +10 -0
- package/dist/website/blocks/ticks.d.ts.map +1 -0
- package/dist/website/blocks/ticks.js +9 -0
- package/dist/website/blocks/ticks.js.map +1 -0
- package/dist/website/blocks/visitor-date.d.ts +2 -0
- package/dist/website/blocks/visitor-date.d.ts.map +1 -0
- package/dist/website/blocks/visitor-date.js +10 -0
- package/dist/website/blocks/visitor-date.js.map +1 -0
- package/package.json +1 -1
- package/styles.css +1138 -20
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The menu of a restaurant or a café: sections of dishes, each with a price, a short text, diet
|
|
3
|
+
* tags and an optional photo. Every word is a prop, so the content writes the dishes, the tags
|
|
4
|
+
* and the currency in the site's language. The rows read like a printed menu: rules between the
|
|
5
|
+
* dishes, no cards, and the prices in the brand's numerals so they line up.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactElement } from "react";
|
|
8
|
+
import { type Action, type Anchor, type BlockImage } from "./parts.js";
|
|
9
|
+
export declare const MENU_VARIANTS: readonly ["sections", "split", "photos"];
|
|
10
|
+
export type MenuVariant = (typeof MENU_VARIANTS)[number];
|
|
11
|
+
/** One dish or drink. The price is text, so the content says the currency and the size. */
|
|
12
|
+
export type MenuDish = {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly price: string;
|
|
15
|
+
readonly text?: string;
|
|
16
|
+
/** Short marks such as "Vegan" or "Spicy", in the site's language. */
|
|
17
|
+
readonly tags?: readonly string[];
|
|
18
|
+
/** A photo of the dish: small beside its row, or the card's picture in the photos layout. */
|
|
19
|
+
readonly image?: BlockImage;
|
|
20
|
+
/** A line under the price, such as "per glass" or "sample price". */
|
|
21
|
+
readonly note?: string;
|
|
22
|
+
};
|
|
23
|
+
/** A part of the menu, such as "Starters" or "Drinks", with an optional line under its name. */
|
|
24
|
+
export type MenuSection = {
|
|
25
|
+
readonly title: string;
|
|
26
|
+
readonly text?: string;
|
|
27
|
+
readonly dishes: readonly MenuDish[];
|
|
28
|
+
};
|
|
29
|
+
export type MenuProps = Anchor & {
|
|
30
|
+
readonly title?: string;
|
|
31
|
+
readonly intro?: string;
|
|
32
|
+
readonly sections: readonly MenuSection[];
|
|
33
|
+
/** A line for the whole menu, such as where to ask about allergens. */
|
|
34
|
+
readonly note?: string;
|
|
35
|
+
/** Usually the founder's own order page or a link to reserve a table. */
|
|
36
|
+
readonly primary?: Action;
|
|
37
|
+
readonly secondary?: Action;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The sections in two columns on a wide screen (sections), the heading beside them and kept in
|
|
41
|
+
* view while the dishes scroll (split), or each dish as a photo card (photos).
|
|
42
|
+
*/
|
|
43
|
+
export declare function menuView(variant: MenuVariant, props: MenuProps): ReactElement;
|
|
44
|
+
//# sourceMappingURL=menu-views.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-views.d.ts","sourceRoot":"","sources":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EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAkGF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY,CAgC7E"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { BLOCK_VARIANTS } from "./catalog.js";
|
|
3
|
+
import { keyed } from "./list.js";
|
|
4
|
+
import { Actions, BlockImg, BlockTitle, bandAttrs, Section, } from "./parts.js";
|
|
5
|
+
import { filled, required } from "./variant.js";
|
|
6
|
+
export const MENU_VARIANTS = BLOCK_VARIANTS.Menu;
|
|
7
|
+
/**
|
|
8
|
+
* Every dish card keeps one size, whatever the length of its section: a section of two drinks
|
|
9
|
+
* would otherwise get two cards twice the size of the dishes above it.
|
|
10
|
+
*/
|
|
11
|
+
const DISH_COLUMNS = "3";
|
|
12
|
+
function Tags({ tags }) {
|
|
13
|
+
if (tags.length === 0)
|
|
14
|
+
return null;
|
|
15
|
+
return (_jsx("ul", { className: "site-menu-tags", children: keyed(tags).map(({ key, item }) => (_jsx("li", { className: "site-tag", children: item }, key))) }));
|
|
16
|
+
}
|
|
17
|
+
function Price({ dish }) {
|
|
18
|
+
return (_jsxs("p", { className: "site-price-amount", children: [dish.price, dish.note ? _jsx("span", { className: "site-price-note", children: dish.note }) : null] }));
|
|
19
|
+
}
|
|
20
|
+
function DishRow({ dish }) {
|
|
21
|
+
return (_jsxs("li", { className: "site-menu-dish", children: [dish.image ? _jsx(BlockImg, { image: dish.image, className: "site-menu-thumb" }) : null, _jsxs("div", { className: "site-menu-words", children: [_jsx("h4", { className: "site-menu-name", children: dish.name }), dish.text ? _jsx("p", { className: "site-card-text", children: dish.text }) : null, _jsx(Tags, { tags: dish.tags ?? [] })] }), _jsx(Price, { dish: dish })] }));
|
|
22
|
+
}
|
|
23
|
+
function DishCard({ dish }) {
|
|
24
|
+
const image = required("Menu", "photos", "image", dish.image, `add an image to "${dish.name}"`);
|
|
25
|
+
return (_jsxs("article", { className: "site-menu-card", children: [_jsx(BlockImg, { image: image, className: "site-menu-photo" }), _jsxs("div", { className: "site-menu-card-head", children: [_jsx("h4", { className: "site-menu-name", children: dish.name }), _jsx(Price, { dish: dish })] }), dish.text ? _jsx("p", { className: "site-card-text", children: dish.text }) : null, _jsx(Tags, { tags: dish.tags ?? [] })] }));
|
|
26
|
+
}
|
|
27
|
+
function MenuGroup({ section, variant, }) {
|
|
28
|
+
const dishes = filled("Menu", variant, "dishes", section.dishes);
|
|
29
|
+
return (_jsxs("div", { className: "site-menu-section", children: [_jsx("h3", { className: "site-menu-heading", children: section.title }), section.text ? _jsx("p", { className: "site-card-text site-menu-section-text", children: section.text }) : null, variant === "photos" ? (_jsx("div", { className: "site-grid site-menu-cards", "data-cols": DISH_COLUMNS, children: keyed(dishes).map(({ key, item }) => (_jsx(DishCard, { dish: item }, key))) })) : (_jsx("ul", { className: "site-menu-list", children: keyed(dishes).map(({ key, item }) => (_jsx(DishRow, { dish: item }, key))) }))] }));
|
|
30
|
+
}
|
|
31
|
+
/** The line for the whole menu and the buttons, under the dishes or under the heading. */
|
|
32
|
+
function Closing({ props }) {
|
|
33
|
+
return (_jsxs(_Fragment, { children: [props.note ? _jsx("p", { className: "site-menu-note", children: props.note }) : null, _jsx(Actions, { primary: props.primary, secondary: props.secondary })] }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The sections in two columns on a wide screen (sections), the heading beside them and kept in
|
|
37
|
+
* view while the dishes scroll (split), or each dish as a photo card (photos).
|
|
38
|
+
*/
|
|
39
|
+
export function menuView(variant, props) {
|
|
40
|
+
const sections = filled("Menu", variant, "sections", props.sections);
|
|
41
|
+
const groups = keyed(sections).map(({ key, item }) => _jsx(MenuGroup, { section: item, variant: variant }, key));
|
|
42
|
+
if (variant === "split")
|
|
43
|
+
return (_jsx("section", { ...bandAttrs("Menu", props, "site-block"), "data-variant": "split", children: _jsxs("div", { className: "site-container site-split-end", children: [_jsxs("div", { className: "site-menu-side", children: [props.title ? _jsx(BlockTitle, { block: "Menu", title: props.title, highlight: props.highlight }) : null, props.intro ? _jsx("p", { className: "site-block-intro", children: props.intro }) : null, _jsx(Closing, { props: props })] }), _jsx("div", { className: "site-menu", children: groups })] }) }));
|
|
44
|
+
const cols = variant === "sections" && sections.length > 1 ? "2" : undefined;
|
|
45
|
+
return (_jsxs(Section, { name: "Menu", id: props.id, tone: props.tone, title: props.title, highlight: props.highlight, intro: props.intro, children: [_jsx("div", { className: "site-menu", "data-variant": variant === "photos" ? "photos" : undefined, "data-cols": cols, children: groups }), _jsx(Closing, { props: props })] }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=menu-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-views.js","sourceRoot":"","sources":["../../../src/website/blocks/menu-views.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAEN,OAAO,EAGP,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,GACP,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC;AAkCjD;;;GAGG;AACH,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,SAAS,IAAI,CAAC,EAAE,IAAI,EAAwC;IAC3D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,CACN,aAAI,SAAS,EAAC,gBAAgB,YAC5B,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,G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AK,CAAC,CAAC,CAAC,YAAG,SAAS,EAAC,kBAAkB,YAAE,KAAK,CAAC,KAAK,GAAK,CAAC,CAAC,CAAC,IAAI,EACvE,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,GAAI,IACpB,EACN,cAAK,SAAS,EAAC,WAAW,YAAE,MAAM,GAAO,IACpC,GACG,CACV,CAAC;IACH,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,OAAO,CACN,MAAC,OAAO,IACP,IAAI,EAAC,MAAM,EACX,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,aAElB,cAAK,SAAS,EAAC,WAAW,kBAAe,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,eAAa,IAAI,YACnG,MAAM,GACF,EACN,KAAC,OAAO,IAAC,KAAK,EAAE,KAAK,GAAI,IAChB,CACV,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
2
|
import type { SiteStrings } from "../../i18n/strings.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { Anchor } from "./parts.js";
|
|
4
4
|
export declare const NEWSLETTER_VARIANTS: readonly ["start", "centered", "panel"];
|
|
5
5
|
export type NewsletterVariant = (typeof NEWSLETTER_VARIANTS)[number];
|
|
6
6
|
export type NewsletterProps = Anchor & {
|
|
@@ -15,10 +15,11 @@ export type NewsletterProps = Anchor & {
|
|
|
15
15
|
readonly note?: string;
|
|
16
16
|
readonly strings: SiteStrings;
|
|
17
17
|
};
|
|
18
|
-
/** One email field and its button,
|
|
18
|
+
/** One email field and its button, in a form that posts to `action`. */
|
|
19
19
|
export declare function EmailSignup({ action, strings, center, }: {
|
|
20
20
|
readonly action: string;
|
|
21
21
|
readonly strings: SiteStrings;
|
|
22
|
+
/** Centres the control in its column, for a layout whose words are centred. */
|
|
22
23
|
readonly center?: boolean;
|
|
23
24
|
}): ReactElement;
|
|
24
25
|
/** A signup for the site's mailing list: one email field and a button. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newsletter-views.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/newsletter-views.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"newsletter-views.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/newsletter-views.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIzC,eAAO,MAAM,mBAAmB,yCAA4B,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC9B,CAAC;AAEF,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,EAC3B,MAAM,EACN,OAAO,EACP,MAAc,GACd,EAAE;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,YAAY,CAQf;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,GAAG,YAAY,CAY/F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
3
|
* Newsletter layouts, adapted from HyperUI's newsletter signups and CTAs
|
|
4
4
|
* (https://github.com/markmead/hyperui, MIT, Copyright (c) Mark Mead): colours, type and radii
|
|
@@ -6,39 +6,27 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
6
6
|
*/
|
|
7
7
|
import { useId } from "react";
|
|
8
8
|
import { BLOCK_VARIANTS } from "./catalog.js";
|
|
9
|
-
import {
|
|
9
|
+
import { SignupFields, signupView } from "./signup.js";
|
|
10
10
|
import { required } from "./variant.js";
|
|
11
11
|
export const NEWSLETTER_VARIANTS = BLOCK_VARIANTS.Newsletter;
|
|
12
|
-
/** One email field and its button,
|
|
12
|
+
/** One email field and its button, in a form that posts to `action`. */
|
|
13
13
|
export function EmailSignup({ action, strings, center = false, }) {
|
|
14
14
|
// Two signups on one page must not share an id, or a label names the other form's field.
|
|
15
15
|
const id = `${useId()}-email`;
|
|
16
|
-
return (
|
|
17
|
-
}
|
|
18
|
-
function Words({ props, center }) {
|
|
19
|
-
const head = center ? "site-block-head-center" : "";
|
|
20
|
-
return (_jsxs(_Fragment, { children: [_jsx(BlockTitle, { block: "Newsletter", title: props.title, highlight: props.highlight, className: `site-block-title ${head}` }), props.text ? _jsx("p", { className: `site-block-intro ${head}`, children: props.text }) : null] }));
|
|
21
|
-
}
|
|
22
|
-
function Note({ note, center }) {
|
|
23
|
-
if (!note)
|
|
24
|
-
return null;
|
|
25
|
-
return _jsx("p", { className: `site-card-text mt-3 ${center ? "text-center" : ""}`, children: note });
|
|
26
|
-
}
|
|
27
|
-
/** The words over the form on a quiet band, aligned to the start (start) or centred (centered). */
|
|
28
|
-
function BandNewsletter({ props, variant, }) {
|
|
29
|
-
const action = required("Newsletter", variant, "action", props.action, 'add action="<the URL the form posts to>"');
|
|
30
|
-
const center = variant === "centered";
|
|
31
|
-
return (_jsx("section", { ...bandAttrs("Newsletter", props, "site-block site-band-muted"), "data-variant": center ? variant : undefined, children: _jsxs("div", { className: "site-container", children: [_jsx(Words, { props: props, center: center }), _jsx(EmailSignup, { action: action, strings: props.strings, center: center }), _jsx(Note, { note: props.note, center: center })] }) }));
|
|
32
|
-
}
|
|
33
|
-
/** A rounded panel with the words on one side and the form on the other. */
|
|
34
|
-
function PanelNewsletter(props) {
|
|
35
|
-
const action = required("Newsletter", "panel", "action", props.action, 'add action="<the URL the form posts to>"');
|
|
36
|
-
return (_jsx("section", { ...bandAttrs("Newsletter", props, "site-block"), "data-variant": "panel", children: _jsx("div", { className: "site-container", children: _jsxs("div", { className: "site-cta-panel grid items-center gap-6 p-8 md:grid-cols-2 md:p-12", children: [_jsxs("div", { children: [_jsx(BlockTitle, { block: "Newsletter", title: props.title, highlight: props.highlight }), props.text ? _jsx("p", { className: "site-media-text", children: props.text }) : null] }), _jsxs("div", { children: [_jsx(EmailSignup, { action: action, strings: props.strings }), _jsx(Note, { note: props.note, center: false })] })] }) }) }));
|
|
16
|
+
return (_jsx("form", { method: "post", action: action, className: center ? "site-form site-signup-center" : "site-form", children: _jsx(SignupFields, { id: id, label: strings.emailAddress, button: strings.subscribe }) }));
|
|
37
17
|
}
|
|
38
18
|
/** A signup for the site's mailing list: one email field and a button. */
|
|
39
19
|
export function newsletterView(variant, props) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
const action = required("Newsletter", variant, "action", props.action, 'add action="<the URL the form posts to>"');
|
|
21
|
+
return signupView(variant, {
|
|
22
|
+
name: "Newsletter",
|
|
23
|
+
id: props.id,
|
|
24
|
+
tone: props.tone,
|
|
25
|
+
highlight: props.highlight,
|
|
26
|
+
title: props.title,
|
|
27
|
+
text: props.text,
|
|
28
|
+
note: props.note,
|
|
29
|
+
form: _jsx(EmailSignup, { action: action, strings: props.strings }),
|
|
30
|
+
});
|
|
43
31
|
}
|
|
44
32
|
//# sourceMappingURL=newsletter-views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"newsletter-views.js","sourceRoot":"","sources":["../../../src/website/blocks/newsletter-views.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,EAAqB,KAAK,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"newsletter-views.js","sourceRoot":"","sources":["../../../src/website/blocks/newsletter-views.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,EAAqB,KAAK,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC,UAAU,CAAC;AAgB7D,wEAAwE;AACxE,MAAM,UAAU,WAAW,CAAC,EAC3B,MAAM,EACN,OAAO,EACP,MAAM,GAAG,KAAK,GAMd;IACA,yFAAyF;IACzF,MAAM,EAAE,GAAG,GAAG,KAAK,EAAE,QAAQ,CAAC;IAC9B,OAAO,CACN,eAAM,MAAM,EAAC,MAAM,EAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,WAAW,YACnG,KAAC,YAAY,IAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS,GAAI,GAC1E,CACP,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,cAAc,CAAC,OAA0B,EAAE,KAAsB;IAChF,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,0CAA0C,CAAC,CAAC;IACnH,OAAO,UAAU,CAAC,OAAO,EAAE;QAC1B,IAAI,EAAE,YAAY;QAClB,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,GAAI;KAC7D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import { type Action, type Anchor, type BlockImage } from "./parts.js";
|
|
3
|
+
export declare const PRODUCTS_VARIANTS: readonly ["grid", "detail"];
|
|
4
|
+
export type ProductsVariant = (typeof PRODUCTS_VARIANTS)[number];
|
|
5
|
+
/** A choice the buyer makes, such as a size. The label names the field and the values are its choices. */
|
|
6
|
+
export type ProductOption = {
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly values: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
/** One product. The price is text, so the content says the currency. */
|
|
11
|
+
export type Product = {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly price: string;
|
|
14
|
+
/** The product's own page or its place on the shop page. The whole card is the link. */
|
|
15
|
+
readonly href?: string;
|
|
16
|
+
readonly image: BlockImage;
|
|
17
|
+
/** More photos of the product, for the detail layout. */
|
|
18
|
+
readonly images?: readonly BlockImage[];
|
|
19
|
+
readonly text?: string;
|
|
20
|
+
/** A short word on the photo, such as "New" or "Sold out", in the site's language. */
|
|
21
|
+
readonly badge?: string;
|
|
22
|
+
/** A line under the price, such as "sample price" or "incl. VAT". */
|
|
23
|
+
readonly note?: string;
|
|
24
|
+
/** The detail layout shows each as a field, and sends the choice to the shop page. */
|
|
25
|
+
readonly options?: readonly ProductOption[];
|
|
26
|
+
};
|
|
27
|
+
export type ProductsProps = Anchor & {
|
|
28
|
+
readonly title?: string;
|
|
29
|
+
readonly intro?: string;
|
|
30
|
+
readonly products: readonly Product[];
|
|
31
|
+
/** Needed by the detail layout: the button, and the founder's own shop, cart or order page. */
|
|
32
|
+
readonly buy?: Action;
|
|
33
|
+
/** The grid layout: a link under the products to the page with all of them. */
|
|
34
|
+
readonly more?: Action;
|
|
35
|
+
};
|
|
36
|
+
/** A grid of pictures with a name and a price each (grid), or one product with its options (detail). */
|
|
37
|
+
export declare function productsView(variant: ProductsVariant, props: ProductsProps): ReactElement;
|
|
38
|
+
//# sourceMappingURL=products-views.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products-views.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/products-views.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,OAAO,CAAC;AAGjD,OAAO,EACN,KAAK,MAAM,EAEX,KAAK,MAAM,EACX,KAAK,UAAU,EAKf,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,iBAAiB,6BAA0B,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,0GAA0G;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s } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The products of a small shop: a grid of pictures with a name and a price under each, and the
|
|
4
|
+
* page of one product with its photos, its options and a button. The site has no cart and no
|
|
5
|
+
* payment of its own, so the button leads to the founder's own shop or order page. Every word is
|
|
6
|
+
* a prop, so the content writes the names, the prices, the options and the buttons in the site's
|
|
7
|
+
* language.
|
|
8
|
+
*/
|
|
9
|
+
import Link from "next/link";
|
|
10
|
+
import { useId } from "react";
|
|
11
|
+
import { BLOCK_VARIANTS } from "./catalog.js";
|
|
12
|
+
import { gridColumns, keyed } from "./list.js";
|
|
13
|
+
import { ActionLink, BlockImg, BlockTitle, bandAttrs, Section, } from "./parts.js";
|
|
14
|
+
import { BlockPropError, filled, required } from "./variant.js";
|
|
15
|
+
export const PRODUCTS_VARIANTS = BLOCK_VARIANTS.Products;
|
|
16
|
+
const MOST_COLUMNS = 4;
|
|
17
|
+
function Price({ product }) {
|
|
18
|
+
return (_jsxs("p", { className: "site-price-amount", children: [product.price, product.note ? _jsx("span", { className: "site-price-note", children: product.note }) : null] }));
|
|
19
|
+
}
|
|
20
|
+
function Badge({ product }) {
|
|
21
|
+
return product.badge ? _jsx("span", { className: "site-tag site-product-badge", children: product.badge }) : null;
|
|
22
|
+
}
|
|
23
|
+
/** The product's name, and the link over the whole card when it has a page. */
|
|
24
|
+
function CardName({ product }) {
|
|
25
|
+
return (_jsx("h3", { className: "site-product-name", children: product.href ? (_jsx(Link, { href: product.href, className: "site-card-link", children: product.name })) : (product.name) }));
|
|
26
|
+
}
|
|
27
|
+
function ProductCard({ product }) {
|
|
28
|
+
return (_jsxs("article", { className: "site-product", children: [_jsxs("div", { className: "site-product-photo", children: [_jsx(BlockImg, { image: product.image, className: "site-product-img" }), _jsx(Badge, { product: product })] }), _jsxs("div", { className: "site-product-head", children: [_jsx(CardName, { product: product }), _jsx(Price, { product: product })] })] }));
|
|
29
|
+
}
|
|
30
|
+
function gridView(props) {
|
|
31
|
+
const products = filled("Products", "grid", "products", props.products);
|
|
32
|
+
return (_jsxs(Section, { name: "Products", id: props.id, tone: props.tone, title: props.title, highlight: props.highlight, intro: props.intro, children: [_jsx("ul", { className: "site-grid site-products", "data-cols": gridColumns(products.length, MOST_COLUMNS), children: keyed(products).map(({ key, item }) => (_jsx("li", { children: _jsx(ProductCard, { product: item }) }, key))) }), props.more ? (_jsx("div", { className: "site-products-more", "data-more": "", children: _jsx(ActionLink, { action: props.more, secondary: true }) })) : null] }));
|
|
33
|
+
}
|
|
34
|
+
/** The main photo, and the others as a row under it that scrolls with CSS scroll-snap. */
|
|
35
|
+
function Gallery({ product }) {
|
|
36
|
+
const more = product.images ?? [];
|
|
37
|
+
return (_jsxs("div", { className: "site-product-gallery", children: [_jsx("div", { className: "site-product-photo", children: _jsx(BlockImg, { image: product.image, className: "site-product-img" }) }), more.length > 0 ? (
|
|
38
|
+
// biome-ignore lint/a11y/noNoninteractiveTabindex: a row that scrolls must take focus, so a keyboard can scroll it
|
|
39
|
+
_jsx("ul", { className: "site-product-thumbs", tabIndex: 0, "aria-label": product.name, children: keyed(more).map(({ key, item }) => (_jsx("li", { className: "site-product-thumb", children: _jsx(BlockImg, { image: item, className: "site-product-img" }) }, key))) })) : null] }));
|
|
40
|
+
}
|
|
41
|
+
/** One choice as a select. Its name is the option's label, so the shop page gets `Size=M`. */
|
|
42
|
+
function OptionField({ option, id }) {
|
|
43
|
+
const values = filled("Products", "detail", `values in the option "${option.label}"`, option.values);
|
|
44
|
+
return (_jsxs("div", { children: [_jsx("label", { htmlFor: id, className: "site-label", children: option.label }), _jsx("select", { id: id, name: option.label, className: "site-input", children: keyed(values).map(({ key, item }) => (_jsx("option", { children: item }, key))) })] }));
|
|
45
|
+
}
|
|
46
|
+
/** A GET form, so the shop page receives the choices as query parameters and no script runs. */
|
|
47
|
+
function BuyForm({ product, buy }) {
|
|
48
|
+
const base = useId();
|
|
49
|
+
return (_jsxs("form", { method: "get", action: buy.href, className: "site-form site-product-form", children: [keyed(product.options ?? []).map(({ key, item }) => (_jsx(OptionField, { option: item, id: `${base}-${key}` }, key))), _jsx("button", { type: "submit", className: "site-button justify-center", children: buy.label })] }));
|
|
50
|
+
}
|
|
51
|
+
function detailView(props) {
|
|
52
|
+
const products = filled("Products", "detail", "products", props.products);
|
|
53
|
+
const [product] = products;
|
|
54
|
+
if (product === undefined || products.length > 1)
|
|
55
|
+
throw new BlockPropError("Products", "detail", "exactly one product", "use the grid layout for more than one product");
|
|
56
|
+
const buy = required("Products", "detail", "buy", props.buy, 'add buy={{ label: "Buy", href: "<your shop or order page>" }}');
|
|
57
|
+
// The block's own title is the page's h2, so the name is one level under it.
|
|
58
|
+
const Name = props.title ? "h3" : "h2";
|
|
59
|
+
return (_jsx("section", { ...bandAttrs("Products", props, "site-block"), "data-variant": "detail", children: _jsxs("div", { className: "site-container", children: [props.title ? _jsx(BlockTitle, { block: "Products", title: props.title, highlight: props.highlight }) : null, props.intro ? _jsx("p", { className: "site-block-intro", children: props.intro }) : null, _jsxs("div", { className: "site-product-detail", children: [_jsx(Gallery, { product: product }), _jsxs("div", { className: "site-product-info", children: [_jsx(Badge, { product: product }), _jsx(Name, { className: "site-product-title", children: product.name }), _jsx(Price, { product: product }), product.text ? _jsx("p", { className: "site-card-text", children: product.text }) : null, _jsx(BuyForm, { product: product, buy: buy })] })] })] }) }));
|
|
60
|
+
}
|
|
61
|
+
/** A grid of pictures with a name and a price each (grid), or one product with its options (detail). */
|
|
62
|
+
export function productsView(variant, props) {
|
|
63
|
+
return variant === "detail" ? detailView(props) : gridView(props);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=products-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products-views.js","sourceRoot":"","sources":["../../../src/website/blocks/products-views.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAqB,KAAK,EAAE,MAAM,OAAO,CAAC;AACjD,O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ps, type ProductsVariant } from "./products-views.js";
|
|
3
|
+
/** What a small shop sells: a grid of products, or the page of one product with a button to the shop. */
|
|
4
|
+
export declare function Products({ variant, ...props }: ProductsProps & {
|
|
5
|
+
readonly variant?: ProductsVariant;
|
|
6
|
+
}): ReactElement;
|
|
7
|
+
//# sourceMappingURL=shop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shop.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/shop.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAqB,KAAK,aAAa,EAAE,KAAK,eAAe,EAAgB,MAAM,qBAAqB,CAAC;AAGhH,yGAAyG;AACzG,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CAAE,GAAG,YAAY,CAEpH"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PRODUCTS_VARIANTS, productsView } from "./products-views.js";
|
|
2
|
+
import { variantOf } from "./variant.js";
|
|
3
|
+
/** What a small shop sells: a grid of products, or the page of one product with a button to the shop. */
|
|
4
|
+
export function Products({ variant, ...props }) {
|
|
5
|
+
return productsView(variantOf("Products", variant, PRODUCTS_VARIANTS), props);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=shop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shop.js","sourceRoot":"","sources":["../../../src/website/blocks/shop.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAA4C,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAChH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,yGAAyG;AACzG,MAAM,UAAU,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAA0D;IACrG,OAAO,YAAY,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { type Anchor } from "./parts.js";
|
|
3
|
+
/** The layouts of a sign-up section: the Newsletter block's variants. */
|
|
4
|
+
export declare const SIGNUP_LAYOUTS: readonly ["start", "centered", "panel"];
|
|
5
|
+
export type SignupLayout = (typeof SIGNUP_LAYOUTS)[number];
|
|
6
|
+
export type SignupFieldsProps = {
|
|
7
|
+
/** The id of the field. Two sign-ups on one page need two ids, or a label names the other field. */
|
|
8
|
+
readonly id: string;
|
|
9
|
+
/** The name of the field, for a screen reader and as the placeholder. */
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly button: string;
|
|
12
|
+
readonly maxLength?: number;
|
|
13
|
+
/** The form waits for an answer: the button says so to a screen reader and takes no press. */
|
|
14
|
+
readonly busy?: boolean;
|
|
15
|
+
readonly disabled?: boolean;
|
|
16
|
+
/** What went wrong, under the field. */
|
|
17
|
+
readonly message?: string;
|
|
18
|
+
/** Something between the field and the message, such as a check that the visitor is a person. */
|
|
19
|
+
readonly children?: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* One email field and its button as one control: they share an edge, and the button sits inside
|
|
23
|
+
* it. On a narrow screen the button moves under the field. The caller owns the `<form>`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function SignupFields(props: SignupFieldsProps): ReactElement;
|
|
26
|
+
/** What takes the control's place after a sign-up: the same box, with a tick and one line. */
|
|
27
|
+
export declare function SignupDone({ text }: {
|
|
28
|
+
readonly text: string;
|
|
29
|
+
}): ReactElement;
|
|
30
|
+
export type SignupSectionProps = Anchor & {
|
|
31
|
+
/** The block's name: its `data-block`, and the name in an error about its props. */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly title: string;
|
|
34
|
+
readonly text?: string;
|
|
35
|
+
/** A line under the form, such as how often mail comes or how to leave the list. */
|
|
36
|
+
readonly note?: string;
|
|
37
|
+
/** The form: the sign-up control inside the caller's own `<form>`, or what replaces it. */
|
|
38
|
+
readonly form: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
/** A sign-up section in one of its layouts, around the caller's form. */
|
|
41
|
+
export declare function signupView(layout: SignupLayout, props: SignupSectionProps): ReactElement;
|
|
42
|
+
//# sourceMappingURL=signup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/signup.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,KAAK,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,yEAAyE;AACzE,eAAO,MAAM,cAAc,yCAA4B,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,iBAAiB,GAAG;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,8FAA8F;IAC9F,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,iGAAiG;IACjG,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAqCnE;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAO5E;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IACzC,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CACzB,CAAC;AAqDF,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB,GAAG,YAAY,CAGxF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BLOCK_VARIANTS } from "./catalog.js";
|
|
3
|
+
import { BlockIcon } from "./icons.js";
|
|
4
|
+
import { BlockTitle, bandAttrs } from "./parts.js";
|
|
5
|
+
/** The layouts of a sign-up section: the Newsletter block's variants. */
|
|
6
|
+
export const SIGNUP_LAYOUTS = BLOCK_VARIANTS.Newsletter;
|
|
7
|
+
/**
|
|
8
|
+
* One email field and its button as one control: they share an edge, and the button sits inside
|
|
9
|
+
* it. On a narrow screen the button moves under the field. The caller owns the `<form>`.
|
|
10
|
+
*/
|
|
11
|
+
export function SignupFields(props) {
|
|
12
|
+
const messageId = `${props.id}-message`;
|
|
13
|
+
return (_jsxs("div", { className: "site-signup-fields", children: [_jsx("label", { htmlFor: props.id, className: "sr-only", children: props.label }), _jsxs("div", { className: "site-signup", "data-invalid": props.message ? "" : undefined, children: [_jsx("input", { id: props.id, name: "email", type: "email", autoComplete: "email", required: true, maxLength: props.maxLength, placeholder: props.label, "aria-invalid": props.message ? true : undefined, "aria-describedby": props.message ? messageId : undefined, className: "site-signup-input" }), _jsx("button", { type: "submit", className: "site-button site-signup-button", disabled: props.disabled || props.busy, "aria-busy": props.busy ? true : undefined, children: props.button })] }), props.children, props.message ? (_jsx("p", { id: messageId, role: "alert", className: "site-signup-message", children: props.message })) : null] }));
|
|
14
|
+
}
|
|
15
|
+
/** What takes the control's place after a sign-up: the same box, with a tick and one line. */
|
|
16
|
+
export function SignupDone({ text }) {
|
|
17
|
+
return (_jsxs("p", { role: "status", className: "site-signup-fields site-signup-done", children: [_jsx(BlockIcon, { name: "check-circle", className: "site-signup-done-icon" }), _jsx("span", { children: text })] }));
|
|
18
|
+
}
|
|
19
|
+
function Note({ note, center }) {
|
|
20
|
+
if (!note)
|
|
21
|
+
return null;
|
|
22
|
+
return _jsx("p", { className: `site-signup-note ${center ? "text-center" : ""}`, children: note });
|
|
23
|
+
}
|
|
24
|
+
/** The words over the form on a quiet band, aligned to the start (start) or centred (centered). */
|
|
25
|
+
function BandSignup({ props, center }) {
|
|
26
|
+
const head = center ? "site-block-head-center" : "";
|
|
27
|
+
return (_jsx("section", { ...bandAttrs(props.name, props, "site-block site-band-muted"), "data-variant": center ? "centered" : undefined, children: _jsxs("div", { className: "site-container", children: [_jsx(BlockTitle, { block: props.name, title: props.title, highlight: props.highlight, className: `site-block-title ${head}` }), props.text ? _jsx("p", { className: `site-block-intro ${head}`, children: props.text }) : null, _jsxs("div", { className: center ? "site-signup-center" : undefined, children: [props.form, _jsx(Note, { note: props.note, center: center })] })] }) }));
|
|
28
|
+
}
|
|
29
|
+
/** A rounded panel with the words on one side and the form on the other. */
|
|
30
|
+
function PanelSignup(props) {
|
|
31
|
+
return (_jsx("section", { ...bandAttrs(props.name, props, "site-block"), "data-variant": "panel", children: _jsx("div", { className: "site-container", children: _jsxs("div", { className: "site-cta-panel site-signup-panel", children: [_jsxs("div", { children: [_jsx(BlockTitle, { block: props.name, title: props.title, highlight: props.highlight }), props.text ? _jsx("p", { className: "site-media-text", children: props.text }) : null] }), _jsxs("div", { children: [props.form, _jsx(Note, { note: props.note, center: false })] })] }) }) }));
|
|
32
|
+
}
|
|
33
|
+
/** A sign-up section in one of its layouts, around the caller's form. */
|
|
34
|
+
export function signupView(layout, props) {
|
|
35
|
+
if (layout === "panel")
|
|
36
|
+
return _jsx(PanelSignup, { ...props });
|
|
37
|
+
return _jsx(BandSignup, { props: props, center: layout === "centered" });
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=signup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signup.js","sourceRoot":"","sources":["../../../src/website/blocks/signup.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAe,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEhE,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC;AAmBxD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACpD,MAAM,SAAS,GAAG,GAAG,KAAK,CAAC,EAAE,UAAU,CAAC;IACxC,OAAO,CACN,eAAK,SAAS,EAAC,oBAAoB,aAClC,gBAAO,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,SAAS,EAAC,SAAS,YAC3C,KAAK,CAAC,KAAK,GACL,EACR,eAAK,SAAS,EAAC,aAAa,kBAAe,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,aACxE,gBACC,EAAE,EAAE,KAAK,CAAC,EAAE,EACZ,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,OAAO,EACZ,YAAY,EAAC,OAAO,EACpB,QAAQ,QACR,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,WAAW,EAA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CAAC,IAAI,GAAK,CAAC,CAAC,CAAC,IAAI,IAC/D,EACN,0BACE,KAAK,CAAC,IAAI,EACX,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAI,IACpC,IACD,GACD,GACG,CACV,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,UAAU,CAAC,MAAoB,EAAE,KAAyB;IACzE,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,KAAC,WAAW,OAAK,KAAK,GAAI,CAAC;IAC1D,OAAO,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU,GAAI,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A list of short lines, each after a tick: what an app does, what a plan includes. One part for
|
|
3
|
+
* every such list, so they look the same on every block.
|
|
4
|
+
*/
|
|
5
|
+
import type { ReactElement } from "react";
|
|
6
|
+
export declare function Ticks({ items, className, }: {
|
|
7
|
+
readonly items?: readonly string[];
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
}): ReactElement | null;
|
|
10
|
+
//# sourceMappingURL=ticks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/ticks.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,wBAAgB,KAAK,CAAC,EACrB,KAAK,EACL,SAAS,GACT,EAAE;IACF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,YAAY,GAAG,IAAI,CAYtB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BlockIcon } from "./icons.js";
|
|
3
|
+
import { keyed } from "./list.js";
|
|
4
|
+
export function Ticks({ items, className, }) {
|
|
5
|
+
if (!items || items.length === 0)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsx("ul", { className: className ? `site-ticks ${className}` : "site-ticks", children: keyed(items).map(({ key, item }) => (_jsxs("li", { className: "site-tick", children: [_jsx(BlockIcon, { name: "check-circle", className: "site-tick-icon" }), _jsx("span", { children: item })] }, key))) }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=ticks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticks.js","sourceRoot":"","sources":["../../../src/website/blocks/ticks.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,MAAM,UAAU,KAAK,CAAC,EACrB,KAAK,EACL,SAAS,GAIT;IACA,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,OAAO,CACN,aAAI,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,SAAS,EAAE,CAAC,CAAC,CAAC,YAAY,YACjE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACpC,cAAc,SAAS,EAAC,WAAW,aAClC,KAAC,SAAS,IAAC,IAAI,EAAC,cAAc,EAAC,SAAS,EAAC,gBAAgB,GAAG,EAC5D,yBAAO,IAAI,GAAQ,KAFX,GAAG,CAGP,CACL,CAAC,GACE,CACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor-date.d.ts","sourceRoot":"","sources":["../../../src/website/blocks/visitor-date.ts"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,CAAC,GAAG,GAAE,IAAiB,GAAG,MAAM,CAE3D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visitor's own date as "YYYY-MM-DD", in the browser's time zone. A static page is built
|
|
3
|
+
* once, so only the browser knows the day it is read on; client parts call this after mount,
|
|
4
|
+
* never during a render the server also runs. The clock is a parameter so a test can pin it.
|
|
5
|
+
*/
|
|
6
|
+
const pad = (value) => String(value).padStart(2, "0");
|
|
7
|
+
export function visitorToday(now = new Date()) {
|
|
8
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=visitor-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor-date.js","sourceRoot":"","sources":["../../../src/website/blocks/visitor-date.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,GAAG,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAEtE,MAAM,UAAU,YAAY,CAAC,MAAY,IAAI,IAAI,EAAE;IAClD,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;AAChF,CAAC"}
|
package/package.json
CHANGED