astryx-dracula 0.5.0 → 0.6.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/BRAND.md +3 -3
- package/README.md +7 -4
- package/USAGE.md +49 -49
- package/astryx-dracula.d.ts +2 -2
- package/astryx-dracula.js +25 -9
- package/astryx-dracula.variants.d.ts +2 -2
- package/astryx.integration.mjs +1 -1
- package/icons.mjs +21 -17
- package/icons.tsx +69 -62
- package/package.json +125 -120
- package/shared/auth-chrome-config.ts +6 -6
- package/shared/auth-chrome.tsx +143 -144
- package/shared/auth-copy.ts +14 -14
- package/shared/chaptered-doc-config.ts +48 -51
- package/shared/chaptered-doc.tsx +267 -289
- package/shared/chart-hues.ts +25 -10
- package/shared/chart-labels.tsx +31 -30
- package/shared/chart-legend.tsx +55 -56
- package/shared/chart-panel-style.ts +3 -3
- package/shared/data-bar.tsx +97 -102
- package/shared/format-money.ts +1 -1
- package/shared/gallery-image.ts +6 -6
- package/shared/login-demo.ts +1 -1
- package/shared/metric-card.tsx +101 -105
- package/shared/metric-delta.tsx +28 -27
- package/shared/order-desk.tsx +205 -216
- package/shared/revenue-chart.tsx +145 -165
- package/shared/scene-castle.tsx +206 -291
- package/shared/scene-frame.tsx +33 -32
- package/shared/scene-hues.ts +17 -17
- package/shared/scene-tile.tsx +88 -92
- package/shared/settings-data.ts +119 -125
- package/shared/settings-rows.tsx +122 -159
- package/shared/sparkline.tsx +75 -88
- package/shared/sso-icons.tsx +10 -22
- package/shared/stars.tsx +16 -25
- package/templates/ai-chat-landing.template.mjs +5 -4
- package/templates/ai-chat-landing.tsx +473 -460
- package/templates/ai-chat.template.mjs +5 -4
- package/templates/ai-chat.tsx +543 -612
- package/templates/blank.template.mjs +5 -4
- package/templates/blank.tsx +18 -14
- package/templates/centered-hero.template.mjs +5 -4
- package/templates/centered-hero.tsx +55 -68
- package/templates/classic-gallery.template.mjs +5 -4
- package/templates/classic-gallery.tsx +97 -104
- package/templates/contact-form.template.mjs +5 -4
- package/templates/contact-form.tsx +247 -282
- package/templates/dashboard-portfolio.template.mjs +5 -4
- package/templates/dashboard-portfolio.tsx +717 -548
- package/templates/dashboard.template.mjs +5 -4
- package/templates/dashboard.tsx +596 -567
- package/templates/detail-page.template.mjs +5 -4
- package/templates/detail-page.tsx +546 -603
- package/templates/documentation-design.template.mjs +5 -4
- package/templates/documentation-design.tsx +231 -243
- package/templates/documentation-technical.template.mjs +5 -4
- package/templates/documentation-technical.tsx +236 -239
- package/templates/documentation.template.mjs +5 -4
- package/templates/documentation.tsx +267 -279
- package/templates/editor.template.mjs +5 -4
- package/templates/editor.tsx +844 -877
- package/templates/file-explorer.template.mjs +5 -4
- package/templates/file-explorer.tsx +566 -590
- package/templates/form-two-column.template.mjs +5 -4
- package/templates/form-two-column.tsx +195 -210
- package/templates/gallery-hero.template.mjs +5 -4
- package/templates/gallery-hero.tsx +93 -114
- package/templates/ide.template.mjs +5 -4
- package/templates/ide.tsx +407 -453
- package/templates/incident-console.template.mjs +5 -4
- package/templates/incident-console.tsx +593 -575
- package/templates/kanban-board.template.mjs +5 -4
- package/templates/kanban-board.tsx +665 -683
- package/templates/library.template.mjs +5 -4
- package/templates/library.tsx +409 -430
- package/templates/login-card.template.mjs +5 -4
- package/templates/login-card.tsx +63 -72
- package/templates/login-split.template.mjs +5 -4
- package/templates/login-split.tsx +192 -193
- package/templates/login-sso.template.mjs +5 -4
- package/templates/login-sso.tsx +257 -258
- package/templates/login.template.mjs +5 -4
- package/templates/login.tsx +53 -49
- package/templates/messaging-shell.template.mjs +5 -4
- package/templates/messaging-shell.tsx +556 -574
- package/templates/mixed-gallery.template.mjs +5 -4
- package/templates/mixed-gallery.tsx +60 -58
- package/templates/payment-form.template.mjs +5 -4
- package/templates/payment-form.tsx +882 -991
- package/templates/product-detail.template.mjs +5 -4
- package/templates/product-detail.tsx +261 -272
- package/templates/product-gallery.template.mjs +5 -4
- package/templates/product-gallery.tsx +126 -137
- package/templates/product-tour.template.mjs +5 -4
- package/templates/product-tour.tsx +741 -773
- package/templates/settings-dialog.template.mjs +5 -4
- package/templates/settings-dialog.tsx +688 -717
- package/templates/settings-sidebar.template.mjs +5 -4
- package/templates/settings-sidebar.tsx +762 -807
- package/templates/settings.template.mjs +5 -4
- package/templates/settings.tsx +289 -304
- package/templates/shell-nav.template.mjs +5 -4
- package/templates/shell-nav.tsx +212 -219
- package/templates/shell-side-nav.template.mjs +5 -4
- package/templates/shell-side-nav.tsx +135 -157
- package/templates/shell-top-nav.template.mjs +5 -4
- package/templates/shell-top-nav.tsx +182 -203
- package/templates/side-gallery.template.mjs +5 -4
- package/templates/side-gallery.tsx +85 -90
- package/templates/table-grouped.template.mjs +5 -4
- package/templates/table-grouped.tsx +1000 -1053
- package/templates/table-page-chart.template.mjs +5 -4
- package/templates/table-page-chart.tsx +400 -398
- package/templates/table-page-heatmap-status.template.mjs +5 -4
- package/templates/table-page-heatmap-status.tsx +483 -512
- package/templates/table-page-shoe-store-heatmap.template.mjs +5 -4
- package/templates/table-page-shoe-store-heatmap.tsx +748 -746
- package/templates/table-page.template.mjs +5 -4
- package/templates/table-page.tsx +396 -405
- package/templates/table.template.mjs +5 -4
- package/templates/table.tsx +92 -93
- package/templates/tech-report.template.mjs +5 -4
- package/templates/tech-report.tsx +1316 -1304
- package/templates/theme-showcase.template.mjs +5 -4
- package/templates/theme-showcase.tsx +871 -951
- package/theme.css +35 -77
- package/theme.css.d.ts +9 -0
- package/tokens.css +373 -380
|
@@ -1,108 +1,90 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// XLE (canonical structure
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from
|
|
14
|
-
import {Grid} from
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {RadioList, RadioListItem} from
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {useMediaQuery} from '@astryxdesign/core/hooks';
|
|
32
|
-
import {Section} from '@astryxdesign/core/Section';
|
|
33
|
-
import {Center} from '@astryxdesign/core/Center';
|
|
34
|
-
import {Icon} from '@astryxdesign/core/Icon';
|
|
35
|
-
import {ShieldCheck, Lock, CircleCheck, Truck} from 'lucide-react';
|
|
2
|
+
// XLE (canonical structure of the tree below; the CLI had no XLE validator
|
|
3
|
+
// after `astryx layout` was removed in 0.7.0, so this is a reading aid and a
|
|
4
|
+
// human drift check — update it with the file, never alone):
|
|
5
|
+
// L[h=fill] > LC[p=0] > Ctr > S.transparent[p=6 mw=1100] > V[g=5] > (V[g=6] > (V[g=2] > (Hd"Payment Request"[level=1 t=display-2] + Tx"Review your order"[t=body]) + D) + H[g=8] > (SI > V[g=8] > (V[g=1] > (H[j=between] > (Hd"Sign in to check out"[level=2] + B.secondary"Sign in") + Tx"Sign in to track your order"[t=body]) + V[g=3] > (Hd"Contact information"[level=2] + TI"Email" + CB"Email me with news and offers") + V[g=3] > (Hd"Shipping information"[level=2] + G[c=2 g=3] > (TI"First Name" + TI"Last Name") + TI"Address" + G[c=2 g=3] > (TI"City" + TI"ZIP Code") + SE"State" + TI"Phone Number" + CB"Save my information for a faster checkout") + V[g=3] > (V[g=1] > (Hd"Delivery"[level=2] + Tx"Processing time"[t=body])) + (RL"Delivery method" > RLI*2) + V[g=3] > (V[g=1] > (Hd"Payment method"[level=2] + Tx"Encrypted"[t=body])) + (V[g=3] > G[c=2 g=3] > (B.secondary"PayPal" + B.secondary"Google Pay")) + D"Or pay with card" + (V[g=3] > TI"Card Number" + G[c=3 g=3] > (SE"Expiry Month" + SE"Expiry Year" + TI"CVC") + TI"Name on Card" + CB"Use shipping address as billing address" + (V[g=3] > TI"Address" + G[c=2 g=3] > (TI"City" + TI"ZIP Code") + SE"State")) + V[g=3] > (Hd"Promo code"[level=2] + H[g=2] > (TI"Promo code" + B.secondary"Apply")) + V[g=3] > (Hd"Gift options"[level=2] + CB"Add a gift message" + (V[g=3] > (G[c=2 g=3] > (TI"To" + TI"From")) + TA"Gift message")) + V[g=4] > (H[g=5] > (H[g=1] > (Ic + Tx))*3 + V[g=2] > (B.primary"Place order" + B.secondary"Continue shopping") + D + H[g=4] > (Lk"Refund policy" + Lk"Privacy policy" + Lk"Terms of service" + Lk"Cancellations"))) + SI > C[p=4] > Col"Order Summary" > V[g=4] > (H[g=3] > (C[p=0] > Scene{SceneTile}) + (SI > V[g=1] > (Tx"Obsidian Ritual Chalice" + Tx"Hand-carved · 12 oz"[t=supporting] + (H[g=2] > NI"Qty" + B.ghost"Remove" + B.ghost"Save"))))*3 + V[g=3] > (Hd"Order Total"[level=3] + V[g=2] > (H[j=between] > (Tx"Subtotal" + Tx"$230.00")) + (H[j=between] > (Tx"Shipping" + Tx"$4.95")) + (H[j=between] > (Tx"Tax" + Tx"$18.40")) + D + (H[j=between] > (Tx"Total"[t=large] + Tx"$253.35"[t=large])) + Bn"Free shipping on orders over $300")))
|
|
6
|
+
|
|
7
|
+
import { Banner } from "@astryxdesign/core/Banner";
|
|
8
|
+
import { Button } from "@astryxdesign/core/Button";
|
|
9
|
+
import { Card } from "@astryxdesign/core/Card";
|
|
10
|
+
import { Center } from "@astryxdesign/core/Center";
|
|
11
|
+
import { CheckboxInput } from "@astryxdesign/core/CheckboxInput";
|
|
12
|
+
import { Collapsible } from "@astryxdesign/core/Collapsible";
|
|
13
|
+
import { Divider } from "@astryxdesign/core/Divider";
|
|
14
|
+
import { Grid } from "@astryxdesign/core/Grid";
|
|
15
|
+
import { useMediaQuery } from "@astryxdesign/core/hooks";
|
|
16
|
+
import { Icon } from "@astryxdesign/core/Icon";
|
|
17
|
+
import { HStack, Layout, LayoutContent, Stack, StackItem, VStack } from "@astryxdesign/core/Layout";
|
|
18
|
+
import { Link } from "@astryxdesign/core/Link";
|
|
19
|
+
import { NumberInput } from "@astryxdesign/core/NumberInput";
|
|
20
|
+
import { RadioList, RadioListItem } from "@astryxdesign/core/RadioList";
|
|
21
|
+
import { Section } from "@astryxdesign/core/Section";
|
|
22
|
+
import { Selector } from "@astryxdesign/core/Selector";
|
|
23
|
+
import { StatusDot } from "@astryxdesign/core/StatusDot";
|
|
24
|
+
import { Heading, Text } from "@astryxdesign/core/Text";
|
|
25
|
+
import { TextArea } from "@astryxdesign/core/TextArea";
|
|
26
|
+
import { TextInput } from "@astryxdesign/core/TextInput";
|
|
27
|
+
import type { SceneHue } from "astryx-dracula/shared/scene-hues";
|
|
28
|
+
import { SceneTile } from "astryx-dracula/shared/scene-tile";
|
|
29
|
+
import { CircleCheck, Lock, ShieldCheck, Truck } from "lucide-react";
|
|
30
|
+
import { type CSSProperties, useState } from "react";
|
|
36
31
|
|
|
37
32
|
// ── Constants ─────────────────────────────────────────────────────────────────
|
|
38
33
|
|
|
39
|
-
const MONTHS = [
|
|
40
|
-
|
|
41
|
-
'02',
|
|
42
|
-
'03',
|
|
43
|
-
'04',
|
|
44
|
-
'05',
|
|
45
|
-
'06',
|
|
46
|
-
'07',
|
|
47
|
-
'08',
|
|
48
|
-
'09',
|
|
49
|
-
'10',
|
|
50
|
-
'11',
|
|
51
|
-
'12',
|
|
52
|
-
];
|
|
53
|
-
const YEARS = Array.from({length: 12}, (_, i) => String(2025 + i));
|
|
34
|
+
const MONTHS = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
|
|
35
|
+
const YEARS = Array.from({ length: 12 }, (_, i) => String(2025 + i));
|
|
54
36
|
|
|
55
37
|
const US_STATES = [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
38
|
+
"Alabama",
|
|
39
|
+
"Alaska",
|
|
40
|
+
"Arizona",
|
|
41
|
+
"Arkansas",
|
|
42
|
+
"California",
|
|
43
|
+
"Colorado",
|
|
44
|
+
"Connecticut",
|
|
45
|
+
"Delaware",
|
|
46
|
+
"Florida",
|
|
47
|
+
"Georgia",
|
|
48
|
+
"Hawaii",
|
|
49
|
+
"Idaho",
|
|
50
|
+
"Illinois",
|
|
51
|
+
"Indiana",
|
|
52
|
+
"Iowa",
|
|
53
|
+
"Kansas",
|
|
54
|
+
"Kentucky",
|
|
55
|
+
"Louisiana",
|
|
56
|
+
"Maine",
|
|
57
|
+
"Maryland",
|
|
58
|
+
"Massachusetts",
|
|
59
|
+
"Michigan",
|
|
60
|
+
"Minnesota",
|
|
61
|
+
"Mississippi",
|
|
62
|
+
"Missouri",
|
|
63
|
+
"Montana",
|
|
64
|
+
"Nebraska",
|
|
65
|
+
"Nevada",
|
|
66
|
+
"New Hampshire",
|
|
67
|
+
"New Jersey",
|
|
68
|
+
"New Mexico",
|
|
69
|
+
"New York",
|
|
70
|
+
"North Carolina",
|
|
71
|
+
"North Dakota",
|
|
72
|
+
"Ohio",
|
|
73
|
+
"Oklahoma",
|
|
74
|
+
"Oregon",
|
|
75
|
+
"Pennsylvania",
|
|
76
|
+
"Rhode Island",
|
|
77
|
+
"South Carolina",
|
|
78
|
+
"South Dakota",
|
|
79
|
+
"Tennessee",
|
|
80
|
+
"Texas",
|
|
81
|
+
"Utah",
|
|
82
|
+
"Vermont",
|
|
83
|
+
"Virginia",
|
|
84
|
+
"Washington",
|
|
85
|
+
"West Virginia",
|
|
86
|
+
"Wisconsin",
|
|
87
|
+
"Wyoming",
|
|
106
88
|
];
|
|
107
89
|
|
|
108
90
|
// One Dracula accent per line item, from the fixed categorical vocabulary.
|
|
@@ -110,36 +92,36 @@ const US_STATES = [
|
|
|
110
92
|
// this map is typed `SceneHue`. `Record<string, string>` let any caller slip
|
|
111
93
|
// purple through to a scene; the union is what stops the next one.
|
|
112
94
|
const ITEM_HUES: Record<string, SceneHue> = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
"1": "var(--dracula-cyan)",
|
|
96
|
+
"2": "var(--dracula-pink)",
|
|
97
|
+
"3": "var(--dracula-yellow)",
|
|
116
98
|
};
|
|
117
99
|
|
|
118
100
|
const ORDER_ITEMS = [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
101
|
+
{
|
|
102
|
+
id: "1",
|
|
103
|
+
name: "Obsidian Ritual Chalice",
|
|
104
|
+
variant: "Hand-carved · 12 oz",
|
|
105
|
+
price: 78,
|
|
106
|
+
qty: 1,
|
|
107
|
+
limited: false,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "2",
|
|
111
|
+
name: "Blood-Moon Offering Plate",
|
|
112
|
+
variant: "Moon-glazed · 10 in",
|
|
113
|
+
price: 72,
|
|
114
|
+
qty: 1,
|
|
115
|
+
limited: false,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "3",
|
|
119
|
+
name: "Crypt Cereal Bowl",
|
|
120
|
+
variant: "Speckled obsidian · 6 in",
|
|
121
|
+
price: 80,
|
|
122
|
+
qty: 1,
|
|
123
|
+
limited: true,
|
|
124
|
+
},
|
|
143
125
|
];
|
|
144
126
|
|
|
145
127
|
const TAX_RATE = 0.08;
|
|
@@ -150,913 +132,822 @@ const fmt = (n: number) => `$${n.toFixed(2)}`;
|
|
|
150
132
|
// Plain inline styles using Astryx design-token CSS variables (declared at
|
|
151
133
|
// :root by `@astryxdesign/core/astryx.css`). No StyleX compiler required.
|
|
152
134
|
|
|
153
|
-
const fullWidth: CSSProperties = {width:
|
|
135
|
+
const fullWidth: CSSProperties = { width: "100%" };
|
|
154
136
|
// Form column flex-basis so the two checkout columns share width evenly.
|
|
155
|
-
const formColBasis: CSSProperties = {flexBasis: 0};
|
|
137
|
+
const formColBasis: CSSProperties = { flexBasis: 0 };
|
|
156
138
|
// Space the Order Summary content below its collapsible trigger title.
|
|
157
|
-
const summaryContent: CSSProperties = {paddingBlockStart:
|
|
139
|
+
const summaryContent: CSSProperties = { paddingBlockStart: "var(--spacing-2)" };
|
|
158
140
|
// Order-summary column: sticky beside the form on desktop.
|
|
159
141
|
const summarySticky: CSSProperties = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
142
|
+
flexBasis: 0,
|
|
143
|
+
position: "sticky",
|
|
144
|
+
top: "var(--spacing-4)",
|
|
145
|
+
alignSelf: "flex-start",
|
|
164
146
|
};
|
|
165
147
|
// On mobile the summary moves above the form.
|
|
166
|
-
const summaryMobileOrder: CSSProperties = {order: -1};
|
|
148
|
+
const summaryMobileOrder: CSSProperties = { order: -1 };
|
|
167
149
|
// Line-item photo: fixed square frame; art lives in shared/scene-tile
|
|
168
150
|
// (lg fork). Astryx has no Image primitive (#2582), so the tile is inline
|
|
169
151
|
// SVG on brand tokens instead of a data-URI bitmap with baked-in hex.
|
|
170
152
|
const itemPhotoFrame: CSSProperties = {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
153
|
+
width: "var(--spacing-10)",
|
|
154
|
+
height: "var(--spacing-10)",
|
|
155
|
+
overflow: "clip",
|
|
156
|
+
flexShrink: 0,
|
|
175
157
|
};
|
|
176
158
|
// Accepted card-network marks (Visa/Mastercard/Amex), shared style.
|
|
177
159
|
const cardLogo: CSSProperties = {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
160
|
+
height: "var(--spacing-7)",
|
|
161
|
+
width: "auto",
|
|
162
|
+
borderRadius: "var(--radius-element)",
|
|
163
|
+
borderWidth: "var(--border-width)",
|
|
164
|
+
borderStyle: "solid",
|
|
165
|
+
borderColor: "var(--color-separator)",
|
|
166
|
+
backgroundColor: "var(--color-background-surface)",
|
|
185
167
|
};
|
|
186
168
|
|
|
187
|
-
function OrderItemPhoto({item}: {item: (typeof ORDER_ITEMS)[number]}) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
169
|
+
function OrderItemPhoto({ item }: { item: (typeof ORDER_ITEMS)[number] }) {
|
|
170
|
+
return (
|
|
171
|
+
<Card padding={0} style={itemPhotoFrame}>
|
|
172
|
+
<SceneTile label={item.name} hue={ITEM_HUES[item.id]} size="lg" />
|
|
173
|
+
</Card>
|
|
174
|
+
);
|
|
193
175
|
}
|
|
194
176
|
|
|
195
177
|
function OrderLineItem({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
178
|
+
item,
|
|
179
|
+
qty,
|
|
180
|
+
onChangeQty,
|
|
199
181
|
}: {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
182
|
+
item: (typeof ORDER_ITEMS)[number];
|
|
183
|
+
qty: number;
|
|
184
|
+
onChangeQty: (v: number) => void;
|
|
203
185
|
}) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
186
|
+
return (
|
|
187
|
+
<HStack gap={3} vAlign="start">
|
|
188
|
+
<OrderItemPhoto item={item} />
|
|
189
|
+
<StackItem size="fill">
|
|
190
|
+
<VStack gap={1}>
|
|
191
|
+
<HStack gap={2} hAlign="between" vAlign="start">
|
|
192
|
+
<HStack gap={2} vAlign="center" wrap="wrap">
|
|
193
|
+
<Text type="body" weight="semibold">
|
|
194
|
+
{item.name}
|
|
195
|
+
</Text>
|
|
196
|
+
{item.limited && (
|
|
197
|
+
<HStack gap={1} vAlign="center">
|
|
198
|
+
<StatusDot variant="warning" label="Limited edition" />
|
|
199
|
+
<Text type="supporting" color="secondary">
|
|
200
|
+
Limited edition
|
|
201
|
+
</Text>
|
|
202
|
+
</HStack>
|
|
203
|
+
)}
|
|
204
|
+
</HStack>
|
|
205
|
+
<Text type="body" hasTabularNumbers>
|
|
206
|
+
{fmt(item.price)}
|
|
207
|
+
</Text>
|
|
208
|
+
</HStack>
|
|
209
|
+
<Text type="supporting" color="secondary">
|
|
210
|
+
{item.variant}
|
|
211
|
+
</Text>
|
|
212
|
+
<HStack gap={2} vAlign="end" wrap="wrap">
|
|
213
|
+
<NumberInput
|
|
214
|
+
label="Qty"
|
|
215
|
+
value={qty}
|
|
216
|
+
onChange={onChangeQty}
|
|
217
|
+
min={1}
|
|
218
|
+
max={10}
|
|
219
|
+
isIntegerOnly
|
|
220
|
+
/>
|
|
221
|
+
{/* Editing the order in place — an action, never a destination. */}
|
|
222
|
+
<Button label="Remove" variant="ghost" onClick={() => {}} />
|
|
223
|
+
<Button label="Save" variant="ghost" onClick={() => {}} />
|
|
224
|
+
</HStack>
|
|
225
|
+
</VStack>
|
|
226
|
+
</StackItem>
|
|
227
|
+
</HStack>
|
|
228
|
+
);
|
|
247
229
|
}
|
|
248
230
|
|
|
249
231
|
function OrderSummaryCard({
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
232
|
+
quantities,
|
|
233
|
+
onChangeQty,
|
|
234
|
+
subtotal,
|
|
235
|
+
shipping,
|
|
236
|
+
tax,
|
|
237
|
+
total,
|
|
256
238
|
}: {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
239
|
+
quantities: Record<string, number>;
|
|
240
|
+
onChangeQty: (id: string, v: number) => void;
|
|
241
|
+
subtotal: number;
|
|
242
|
+
shipping: number;
|
|
243
|
+
tax: number;
|
|
244
|
+
total: number;
|
|
263
245
|
}) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
</VStack>
|
|
285
|
-
</Collapsible>
|
|
286
|
-
</VStack>
|
|
287
|
-
</Card>
|
|
288
|
-
);
|
|
246
|
+
return (
|
|
247
|
+
<Card padding={4}>
|
|
248
|
+
<VStack gap={4}>
|
|
249
|
+
{/* Accordion header — clickable on mobile only */}
|
|
250
|
+
<Collapsible trigger="Order Summary" defaultIsOpen={true}>
|
|
251
|
+
<VStack gap={4} style={summaryContent}>
|
|
252
|
+
{ORDER_ITEMS.map((item) => (
|
|
253
|
+
<OrderLineItem
|
|
254
|
+
key={item.id}
|
|
255
|
+
item={item}
|
|
256
|
+
qty={quantities[item.id] ?? item.qty}
|
|
257
|
+
onChangeQty={(v) => onChangeQty(item.id, v)}
|
|
258
|
+
/>
|
|
259
|
+
))}
|
|
260
|
+
<OrderTotalSection subtotal={subtotal} shipping={shipping} tax={tax} total={total} />
|
|
261
|
+
</VStack>
|
|
262
|
+
</Collapsible>
|
|
263
|
+
</VStack>
|
|
264
|
+
</Card>
|
|
265
|
+
);
|
|
289
266
|
}
|
|
290
267
|
|
|
291
268
|
function OrderTotalSection({
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
269
|
+
subtotal,
|
|
270
|
+
shipping,
|
|
271
|
+
tax,
|
|
272
|
+
total,
|
|
296
273
|
}: {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
274
|
+
subtotal: number;
|
|
275
|
+
shipping: number;
|
|
276
|
+
tax: number;
|
|
277
|
+
total: number;
|
|
301
278
|
}) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
</VStack>
|
|
346
|
-
);
|
|
279
|
+
return (
|
|
280
|
+
<VStack gap={3}>
|
|
281
|
+
<Heading level={3}>Order Total</Heading>
|
|
282
|
+
<VStack gap={2}>
|
|
283
|
+
<HStack hAlign="between" vAlign="center">
|
|
284
|
+
<Text type="body" color="secondary">
|
|
285
|
+
Subtotal
|
|
286
|
+
</Text>
|
|
287
|
+
<Text type="body" hasTabularNumbers>
|
|
288
|
+
{fmt(subtotal)}
|
|
289
|
+
</Text>
|
|
290
|
+
</HStack>
|
|
291
|
+
<HStack hAlign="between" vAlign="center">
|
|
292
|
+
<Text type="body" color="secondary">
|
|
293
|
+
Shipping
|
|
294
|
+
</Text>
|
|
295
|
+
<Text type="body" hasTabularNumbers>
|
|
296
|
+
{fmt(shipping)}
|
|
297
|
+
</Text>
|
|
298
|
+
</HStack>
|
|
299
|
+
<HStack hAlign="between" vAlign="center">
|
|
300
|
+
<Text type="body" color="secondary">
|
|
301
|
+
Tax
|
|
302
|
+
</Text>
|
|
303
|
+
<Text type="body" hasTabularNumbers>
|
|
304
|
+
{fmt(tax)}
|
|
305
|
+
</Text>
|
|
306
|
+
</HStack>
|
|
307
|
+
</VStack>
|
|
308
|
+
<Divider />
|
|
309
|
+
<HStack hAlign="between" vAlign="center">
|
|
310
|
+
<Text type="large">Total</Text>
|
|
311
|
+
<Text type="large" hasTabularNumbers>
|
|
312
|
+
{fmt(total)}
|
|
313
|
+
</Text>
|
|
314
|
+
</HStack>
|
|
315
|
+
<Banner
|
|
316
|
+
status="info"
|
|
317
|
+
icon={<Icon icon={Truck} size="sm" />}
|
|
318
|
+
title="Free shipping on orders over $300"
|
|
319
|
+
/>
|
|
320
|
+
</VStack>
|
|
321
|
+
);
|
|
347
322
|
}
|
|
348
323
|
|
|
349
|
-
const TRUST_ITEMS: Array<{icon: typeof ShieldCheck; label: string}> = [
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
324
|
+
const TRUST_ITEMS: Array<{ icon: typeof ShieldCheck; label: string }> = [
|
|
325
|
+
{ icon: ShieldCheck, label: "Secure Payment" },
|
|
326
|
+
{ icon: Lock, label: "SSL Encrypted" },
|
|
327
|
+
{ icon: CircleCheck, label: "Free Returns" },
|
|
353
328
|
];
|
|
354
329
|
|
|
355
|
-
const SELF_HREF =
|
|
330
|
+
const SELF_HREF = "#/templates/payment-form";
|
|
356
331
|
|
|
357
|
-
const POLICY_LINKS = [
|
|
358
|
-
'Refund policy',
|
|
359
|
-
'Privacy policy',
|
|
360
|
-
'Terms of service',
|
|
361
|
-
'Cancellations',
|
|
362
|
-
];
|
|
332
|
+
const POLICY_LINKS = ["Refund policy", "Privacy policy", "Terms of service", "Cancellations"];
|
|
363
333
|
|
|
364
334
|
function TrustBar() {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
335
|
+
return (
|
|
336
|
+
<HStack gap={5} hAlign="center" wrap="wrap">
|
|
337
|
+
{TRUST_ITEMS.map((item) => (
|
|
338
|
+
<HStack key={item.label} gap={1} vAlign="center">
|
|
339
|
+
<Icon icon={item.icon} size="sm" color="secondary" />
|
|
340
|
+
<Text type="supporting" color="secondary">
|
|
341
|
+
{item.label}
|
|
342
|
+
</Text>
|
|
343
|
+
</HStack>
|
|
344
|
+
))}
|
|
345
|
+
</HStack>
|
|
346
|
+
);
|
|
377
347
|
}
|
|
378
348
|
|
|
379
349
|
function PolicyLinks() {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
350
|
+
return (
|
|
351
|
+
<HStack gap={4} vAlign="center" wrap="wrap">
|
|
352
|
+
{POLICY_LINKS.map((label) => (
|
|
353
|
+
<Link key={label} href={SELF_HREF} type="supporting">
|
|
354
|
+
{label}
|
|
355
|
+
</Link>
|
|
356
|
+
))}
|
|
357
|
+
</HStack>
|
|
358
|
+
);
|
|
389
359
|
}
|
|
390
360
|
|
|
391
361
|
export default function PaymentForm() {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
endContent={
|
|
696
|
-
<Text
|
|
697
|
-
type="body"
|
|
698
|
-
weight="semibold"
|
|
699
|
-
hasTabularNumbers>
|
|
700
|
-
$9.95
|
|
701
|
-
</Text>
|
|
702
|
-
}
|
|
703
|
-
/>
|
|
704
|
-
</RadioList>
|
|
705
|
-
</VStack>
|
|
706
|
-
|
|
707
|
-
{/* Payment Method */}
|
|
708
|
-
<VStack gap={3}>
|
|
709
|
-
<VStack gap={1}>
|
|
710
|
-
<Heading level={2}>Payment method</Heading>
|
|
711
|
-
<Text type="body" color="secondary">
|
|
712
|
-
All transactions are secure and encrypted.
|
|
713
|
-
</Text>
|
|
714
|
-
</VStack>
|
|
715
|
-
|
|
716
|
-
{/* Express checkout */}
|
|
717
|
-
<VStack gap={3}>
|
|
718
|
-
<Grid columns={isMobile ? 1 : 2} gap={3}>
|
|
719
|
-
{/* PayPal */}
|
|
720
|
-
<Button
|
|
721
|
-
label="PayPal"
|
|
722
|
-
variant="secondary"
|
|
723
|
-
size="lg"
|
|
724
|
-
onClick={() => {}}
|
|
725
|
-
/>
|
|
726
|
-
{/* Google Pay */}
|
|
727
|
-
<Button
|
|
728
|
-
label="Google Pay"
|
|
729
|
-
variant="secondary"
|
|
730
|
-
size="lg"
|
|
731
|
-
onClick={() => {}}
|
|
732
|
-
/>
|
|
733
|
-
</Grid>
|
|
734
|
-
</VStack>
|
|
735
|
-
|
|
736
|
-
<Divider label="Or pay with card" />
|
|
737
|
-
|
|
738
|
-
{/* Credit card fields */}
|
|
739
|
-
<VStack gap={3}>
|
|
740
|
-
{/* Card type icons — inline Dracula marks on
|
|
362
|
+
// 768, not 767: eight sibling templates gate the same collapse at exactly
|
|
363
|
+
// 768 (`documentation-design.tsx:568`, `documentation-technical.tsx:61`,
|
|
364
|
+
// `editor.tsx:640`, `file-explorer.tsx:375`, `ide.tsx:244`,
|
|
365
|
+
// `settings-sidebar.tsx:127`, `settings.tsx:79`, `messaging-shell.tsx:393`),
|
|
366
|
+
// and this file's own second query below is 1024. At 767 this was the only
|
|
367
|
+
// off-by-one in the set, so at exactly a 768px viewport `isMobile` was
|
|
368
|
+
// false while `isStacked` was true: the outer Stack had already gone
|
|
369
|
+
// vertical (`:514`) and all six `columns={isMobile ? 1 : N}` grids below
|
|
370
|
+
// stayed wide inside it, including the 3-column expiry row at `:821`.
|
|
371
|
+
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
372
|
+
const isStacked = useMediaQuery("(max-width: 1024px)");
|
|
373
|
+
const [firstName, setFirstName] = useState("");
|
|
374
|
+
const [lastName, setLastName] = useState("");
|
|
375
|
+
const [address, setAddress] = useState("");
|
|
376
|
+
const [city, setCity] = useState("");
|
|
377
|
+
const [zip, setZip] = useState("");
|
|
378
|
+
const [state, setState] = useState("");
|
|
379
|
+
const [phone, setPhone] = useState("");
|
|
380
|
+
const [saveInfo, setSaveInfo] = useState(false);
|
|
381
|
+
const [email, setEmail] = useState("");
|
|
382
|
+
const [emailOffers, setEmailOffers] = useState(false);
|
|
383
|
+
const [deliveryMethod, setDeliveryMethod] = useState("standard");
|
|
384
|
+
const [paymentMethod, _setPaymentMethod] = useState("card");
|
|
385
|
+
const [cardNumber, setCardNumber] = useState("");
|
|
386
|
+
const [expiry, setExpiry] = useState("");
|
|
387
|
+
const [expYear, setExpYear] = useState("");
|
|
388
|
+
const [billingMatchesShipping, setBillingMatchesShipping] = useState(true);
|
|
389
|
+
const [billingAddress, setBillingAddress] = useState("");
|
|
390
|
+
const [billingCity, setBillingCity] = useState("");
|
|
391
|
+
const [billingZip, setBillingZip] = useState("");
|
|
392
|
+
const [billingState, setBillingState] = useState("");
|
|
393
|
+
const [addGiftMessage, setAddGiftMessage] = useState(false);
|
|
394
|
+
const [giftTo, setGiftTo] = useState("");
|
|
395
|
+
const [giftFrom, setGiftFrom] = useState("");
|
|
396
|
+
const [giftMessage, setGiftMessage] = useState("");
|
|
397
|
+
const [cvc, setCvc] = useState("");
|
|
398
|
+
const [cardName, setCardName] = useState("");
|
|
399
|
+
const [promo, setPromo] = useState("");
|
|
400
|
+
const [quantities, setQuantities] = useState<Record<string, number>>({
|
|
401
|
+
"1": 1,
|
|
402
|
+
"2": 1,
|
|
403
|
+
"3": 1,
|
|
404
|
+
});
|
|
405
|
+
const [submitted, setSubmitted] = useState(false);
|
|
406
|
+
|
|
407
|
+
// Totals follow the editable quantities (and the free-shipping banner:
|
|
408
|
+
// orders at or over the threshold ship free).
|
|
409
|
+
const subtotal = ORDER_ITEMS.reduce(
|
|
410
|
+
(sum, item) => sum + item.price * (quantities[item.id] ?? item.qty),
|
|
411
|
+
0,
|
|
412
|
+
);
|
|
413
|
+
const shipping =
|
|
414
|
+
subtotal >= FREE_SHIPPING_THRESHOLD ? 0 : deliveryMethod === "expedited" ? 9.95 : 4.95;
|
|
415
|
+
const tax = Math.round(subtotal * TAX_RATE * 100) / 100;
|
|
416
|
+
const total = subtotal + shipping + tax;
|
|
417
|
+
|
|
418
|
+
// One lockstep 'Required' string for every empty field: seventeen call
|
|
419
|
+
// sites share this one spelling, so a copy change cannot leave one field
|
|
420
|
+
// behind with the old text.
|
|
421
|
+
const required = (hasValue: unknown): string | undefined => (hasValue ? undefined : "Required");
|
|
422
|
+
|
|
423
|
+
const errors: Record<string, string | undefined> = submitted
|
|
424
|
+
? {
|
|
425
|
+
firstName: required(firstName.trim()),
|
|
426
|
+
lastName: required(lastName.trim()),
|
|
427
|
+
address: required(address.trim()),
|
|
428
|
+
city: required(city.trim()),
|
|
429
|
+
zip: required(zip.trim()),
|
|
430
|
+
state: required(state),
|
|
431
|
+
email: required(email.trim()),
|
|
432
|
+
phone: required(phone.trim()),
|
|
433
|
+
expiry: required(expiry),
|
|
434
|
+
expYear: required(expYear),
|
|
435
|
+
cvc: required(cvc.trim()),
|
|
436
|
+
cardNumber: paymentMethod === "card" ? required(cardNumber.trim()) : undefined,
|
|
437
|
+
cardName: paymentMethod === "card" ? required(cardName.trim()) : undefined,
|
|
438
|
+
billingAddress: !billingMatchesShipping ? required(billingAddress.trim()) : undefined,
|
|
439
|
+
billingCity: !billingMatchesShipping ? required(billingCity.trim()) : undefined,
|
|
440
|
+
billingZip: !billingMatchesShipping ? required(billingZip.trim()) : undefined,
|
|
441
|
+
billingState: !billingMatchesShipping ? required(billingState) : undefined,
|
|
442
|
+
}
|
|
443
|
+
: {};
|
|
444
|
+
|
|
445
|
+
return (
|
|
446
|
+
<Layout
|
|
447
|
+
height="fill"
|
|
448
|
+
content={
|
|
449
|
+
<LayoutContent padding={0}>
|
|
450
|
+
<Center axis="horizontal">
|
|
451
|
+
<Section variant="transparent" maxWidth={1100} width="100%" padding={6}>
|
|
452
|
+
<VStack gap={5}>
|
|
453
|
+
{/* Page header */}
|
|
454
|
+
<VStack gap={6}>
|
|
455
|
+
<VStack gap={2}>
|
|
456
|
+
<Heading level={1} type="display-2">
|
|
457
|
+
Payment Request
|
|
458
|
+
</Heading>
|
|
459
|
+
<Text type="body" color="secondary">
|
|
460
|
+
Review your order and complete your purchase. All transactions are sealed with
|
|
461
|
+
256-bit SSL encryption.
|
|
462
|
+
</Text>
|
|
463
|
+
</VStack>
|
|
464
|
+
<Divider />
|
|
465
|
+
</VStack>
|
|
466
|
+
|
|
467
|
+
<Stack direction={isStacked ? "vertical" : "horizontal"} gap={8} vAlign="start">
|
|
468
|
+
<StackItem size="fill" style={isStacked ? undefined : formColBasis}>
|
|
469
|
+
<VStack gap={8}>
|
|
470
|
+
{/* Sign in */}
|
|
471
|
+
<VStack gap={1}>
|
|
472
|
+
<HStack gap={2} hAlign="between" vAlign="center">
|
|
473
|
+
<Heading level={2}>Sign in to check out</Heading>
|
|
474
|
+
<Button label="Sign in" variant="secondary" onClick={() => {}} />
|
|
475
|
+
</HStack>
|
|
476
|
+
<Text type="body" color="secondary">
|
|
477
|
+
Sign in to track your order and save your information for faster checkout.
|
|
478
|
+
</Text>
|
|
479
|
+
</VStack>
|
|
480
|
+
|
|
481
|
+
{/* Contact Information */}
|
|
482
|
+
<VStack gap={3}>
|
|
483
|
+
<Heading level={2}>Contact information</Heading>
|
|
484
|
+
<TextInput
|
|
485
|
+
size="lg"
|
|
486
|
+
label="Email"
|
|
487
|
+
isRequired
|
|
488
|
+
placeholder="you@castle.dracula"
|
|
489
|
+
value={email}
|
|
490
|
+
onChange={setEmail}
|
|
491
|
+
status={
|
|
492
|
+
errors.email ? { type: "error", message: errors.email } : undefined
|
|
493
|
+
}
|
|
494
|
+
/>
|
|
495
|
+
<CheckboxInput
|
|
496
|
+
label="Email me with news and offers"
|
|
497
|
+
value={emailOffers}
|
|
498
|
+
onChange={setEmailOffers}
|
|
499
|
+
/>
|
|
500
|
+
</VStack>
|
|
501
|
+
|
|
502
|
+
{/* Shipping Information */}
|
|
503
|
+
<VStack gap={3}>
|
|
504
|
+
<Heading level={2}>Shipping information</Heading>
|
|
505
|
+
<Grid columns={isMobile ? 1 : 2} gap={3}>
|
|
506
|
+
<TextInput
|
|
507
|
+
size="lg"
|
|
508
|
+
label="First Name"
|
|
509
|
+
isRequired
|
|
510
|
+
placeholder="Vlad"
|
|
511
|
+
value={firstName}
|
|
512
|
+
onChange={setFirstName}
|
|
513
|
+
status={
|
|
514
|
+
errors.firstName
|
|
515
|
+
? { type: "error", message: errors.firstName }
|
|
516
|
+
: undefined
|
|
517
|
+
}
|
|
518
|
+
/>
|
|
519
|
+
<TextInput
|
|
520
|
+
size="lg"
|
|
521
|
+
label="Last Name"
|
|
522
|
+
isRequired
|
|
523
|
+
placeholder="Dracul"
|
|
524
|
+
value={lastName}
|
|
525
|
+
onChange={setLastName}
|
|
526
|
+
status={
|
|
527
|
+
errors.lastName
|
|
528
|
+
? { type: "error", message: errors.lastName }
|
|
529
|
+
: undefined
|
|
530
|
+
}
|
|
531
|
+
/>
|
|
532
|
+
</Grid>
|
|
533
|
+
<TextInput
|
|
534
|
+
size="lg"
|
|
535
|
+
label="Address"
|
|
536
|
+
isRequired
|
|
537
|
+
placeholder="666 Castle Way"
|
|
538
|
+
value={address}
|
|
539
|
+
onChange={setAddress}
|
|
540
|
+
status={
|
|
541
|
+
errors.address ? { type: "error", message: errors.address } : undefined
|
|
542
|
+
}
|
|
543
|
+
/>
|
|
544
|
+
<Grid columns={isMobile ? 1 : 2} gap={3}>
|
|
545
|
+
<TextInput
|
|
546
|
+
size="lg"
|
|
547
|
+
label="City"
|
|
548
|
+
isRequired
|
|
549
|
+
placeholder="Transylvania"
|
|
550
|
+
value={city}
|
|
551
|
+
onChange={setCity}
|
|
552
|
+
status={
|
|
553
|
+
errors.city ? { type: "error", message: errors.city } : undefined
|
|
554
|
+
}
|
|
555
|
+
/>
|
|
556
|
+
<TextInput
|
|
557
|
+
size="lg"
|
|
558
|
+
label="ZIP Code"
|
|
559
|
+
isRequired
|
|
560
|
+
placeholder="40000"
|
|
561
|
+
value={zip}
|
|
562
|
+
onChange={setZip}
|
|
563
|
+
status={errors.zip ? { type: "error", message: errors.zip } : undefined}
|
|
564
|
+
/>
|
|
565
|
+
</Grid>
|
|
566
|
+
<Selector
|
|
567
|
+
size="lg"
|
|
568
|
+
label="State"
|
|
569
|
+
isRequired
|
|
570
|
+
placeholder="Select state"
|
|
571
|
+
options={US_STATES}
|
|
572
|
+
value={state}
|
|
573
|
+
onChange={setState}
|
|
574
|
+
status={
|
|
575
|
+
errors.state ? { type: "error", message: errors.state } : undefined
|
|
576
|
+
}
|
|
577
|
+
/>
|
|
578
|
+
<TextInput
|
|
579
|
+
size="lg"
|
|
580
|
+
label="Phone Number"
|
|
581
|
+
isRequired
|
|
582
|
+
placeholder="+1 (555) 123-4567"
|
|
583
|
+
value={phone}
|
|
584
|
+
onChange={setPhone}
|
|
585
|
+
labelTooltip="We use your phone number to provide shipping updates and contact you about your delivery if needed."
|
|
586
|
+
status={
|
|
587
|
+
errors.phone ? { type: "error", message: errors.phone } : undefined
|
|
588
|
+
}
|
|
589
|
+
/>
|
|
590
|
+
<CheckboxInput
|
|
591
|
+
label="Save my information for a faster checkout"
|
|
592
|
+
value={saveInfo}
|
|
593
|
+
onChange={setSaveInfo}
|
|
594
|
+
/>
|
|
595
|
+
</VStack>
|
|
596
|
+
|
|
597
|
+
{/* Delivery */}
|
|
598
|
+
<VStack gap={3}>
|
|
599
|
+
<VStack gap={1}>
|
|
600
|
+
<Heading level={2}>Delivery</Heading>
|
|
601
|
+
<Text type="body" color="secondary">
|
|
602
|
+
Please allow 1–3 business days processing time before your order ships.
|
|
603
|
+
</Text>
|
|
604
|
+
</VStack>
|
|
605
|
+
<RadioList
|
|
606
|
+
label="Delivery method"
|
|
607
|
+
value={deliveryMethod}
|
|
608
|
+
onChange={setDeliveryMethod}
|
|
609
|
+
>
|
|
610
|
+
<RadioListItem
|
|
611
|
+
value="standard"
|
|
612
|
+
label="Standard (3–7 business days)"
|
|
613
|
+
endContent={
|
|
614
|
+
<Text type="body" weight="semibold" hasTabularNumbers>
|
|
615
|
+
$4.95
|
|
616
|
+
</Text>
|
|
617
|
+
}
|
|
618
|
+
/>
|
|
619
|
+
<RadioListItem
|
|
620
|
+
value="expedited"
|
|
621
|
+
label="Expedited (1–2 business days)"
|
|
622
|
+
endContent={
|
|
623
|
+
<Text type="body" weight="semibold" hasTabularNumbers>
|
|
624
|
+
$9.95
|
|
625
|
+
</Text>
|
|
626
|
+
}
|
|
627
|
+
/>
|
|
628
|
+
</RadioList>
|
|
629
|
+
</VStack>
|
|
630
|
+
|
|
631
|
+
{/* Payment Method */}
|
|
632
|
+
<VStack gap={3}>
|
|
633
|
+
<VStack gap={1}>
|
|
634
|
+
<Heading level={2}>Payment method</Heading>
|
|
635
|
+
<Text type="body" color="secondary">
|
|
636
|
+
All transactions are secure and encrypted.
|
|
637
|
+
</Text>
|
|
638
|
+
</VStack>
|
|
639
|
+
|
|
640
|
+
{/* Express checkout */}
|
|
641
|
+
<VStack gap={3}>
|
|
642
|
+
<Grid columns={isMobile ? 1 : 2} gap={3}>
|
|
643
|
+
{/* PayPal */}
|
|
644
|
+
<Button
|
|
645
|
+
label="PayPal"
|
|
646
|
+
variant="secondary"
|
|
647
|
+
size="lg"
|
|
648
|
+
onClick={() => {}}
|
|
649
|
+
/>
|
|
650
|
+
{/* Google Pay */}
|
|
651
|
+
<Button
|
|
652
|
+
label="Google Pay"
|
|
653
|
+
variant="secondary"
|
|
654
|
+
size="lg"
|
|
655
|
+
onClick={() => {}}
|
|
656
|
+
/>
|
|
657
|
+
</Grid>
|
|
658
|
+
</VStack>
|
|
659
|
+
|
|
660
|
+
<Divider label="Or pay with card" />
|
|
661
|
+
|
|
662
|
+
{/* Credit card fields */}
|
|
663
|
+
<VStack gap={3}>
|
|
664
|
+
{/* Card type icons — inline Dracula marks on
|
|
741
665
|
brand tokens; no vendor hotlinks. */}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
size="lg"
|
|
1030
|
-
style={fullWidth}
|
|
1031
|
-
onClick={() => {}}
|
|
1032
|
-
/>
|
|
1033
|
-
</VStack>
|
|
1034
|
-
<Divider />
|
|
1035
|
-
<PolicyLinks />
|
|
1036
|
-
</VStack>
|
|
1037
|
-
</VStack>
|
|
1038
|
-
</StackItem>
|
|
1039
|
-
|
|
1040
|
-
<StackItem
|
|
1041
|
-
size="fill"
|
|
1042
|
-
style={isStacked ? summaryMobileOrder : summarySticky}>
|
|
1043
|
-
<OrderSummaryCard
|
|
1044
|
-
quantities={quantities}
|
|
1045
|
-
onChangeQty={(id, v) =>
|
|
1046
|
-
setQuantities(q => ({...q, [id]: v}))
|
|
1047
|
-
}
|
|
1048
|
-
subtotal={subtotal}
|
|
1049
|
-
shipping={shipping}
|
|
1050
|
-
tax={tax}
|
|
1051
|
-
total={total}
|
|
1052
|
-
/>
|
|
1053
|
-
</StackItem>
|
|
1054
|
-
</Stack>
|
|
1055
|
-
</VStack>
|
|
1056
|
-
</Section>
|
|
1057
|
-
</Center>
|
|
1058
|
-
</LayoutContent>
|
|
1059
|
-
}
|
|
1060
|
-
/>
|
|
1061
|
-
);
|
|
666
|
+
<HStack gap={1.5} vAlign="center">
|
|
667
|
+
<svg viewBox="0 0 48 32" role="img" aria-label="Visa" style={cardLogo}>
|
|
668
|
+
<rect width="48" height="32" fill="var(--color-background-surface)" />
|
|
669
|
+
<text
|
|
670
|
+
x="24"
|
|
671
|
+
y="21"
|
|
672
|
+
textAnchor="middle"
|
|
673
|
+
fontSize="10"
|
|
674
|
+
fontStyle="italic"
|
|
675
|
+
fill="var(--dracula-comment)"
|
|
676
|
+
>
|
|
677
|
+
VISA
|
|
678
|
+
</text>
|
|
679
|
+
</svg>
|
|
680
|
+
<svg
|
|
681
|
+
viewBox="0 0 48 32"
|
|
682
|
+
role="img"
|
|
683
|
+
aria-label="Mastercard"
|
|
684
|
+
style={cardLogo}
|
|
685
|
+
>
|
|
686
|
+
<rect width="48" height="32" fill="var(--color-background-surface)" />
|
|
687
|
+
<circle cx="19" cy="16" r="8" fill="var(--dracula-red)" />
|
|
688
|
+
<circle
|
|
689
|
+
cx="29"
|
|
690
|
+
cy="16"
|
|
691
|
+
r="8"
|
|
692
|
+
fill="var(--dracula-orange)"
|
|
693
|
+
opacity={0.85}
|
|
694
|
+
/>
|
|
695
|
+
</svg>
|
|
696
|
+
<svg viewBox="0 0 48 32" role="img" aria-label="Amex" style={cardLogo}>
|
|
697
|
+
<rect width="48" height="32" fill="var(--color-background-surface)" />
|
|
698
|
+
<text
|
|
699
|
+
x="24"
|
|
700
|
+
y="21"
|
|
701
|
+
textAnchor="middle"
|
|
702
|
+
fontSize="10"
|
|
703
|
+
fill="var(--dracula-cyan)"
|
|
704
|
+
>
|
|
705
|
+
AMEX
|
|
706
|
+
</text>
|
|
707
|
+
</svg>
|
|
708
|
+
</HStack>
|
|
709
|
+
<TextInput
|
|
710
|
+
size="lg"
|
|
711
|
+
label="Card Number"
|
|
712
|
+
isRequired
|
|
713
|
+
placeholder="1234 5678 9012 3456"
|
|
714
|
+
value={cardNumber}
|
|
715
|
+
onChange={setCardNumber}
|
|
716
|
+
status={
|
|
717
|
+
errors.cardNumber
|
|
718
|
+
? { type: "error", message: errors.cardNumber }
|
|
719
|
+
: undefined
|
|
720
|
+
}
|
|
721
|
+
/>
|
|
722
|
+
<Grid columns={isMobile ? 1 : 3} gap={3}>
|
|
723
|
+
<Selector
|
|
724
|
+
size="lg"
|
|
725
|
+
label="Expiry Month"
|
|
726
|
+
isRequired
|
|
727
|
+
placeholder="MM"
|
|
728
|
+
options={MONTHS}
|
|
729
|
+
value={expiry}
|
|
730
|
+
onChange={setExpiry}
|
|
731
|
+
status={
|
|
732
|
+
errors.expiry
|
|
733
|
+
? { type: "error", message: errors.expiry }
|
|
734
|
+
: undefined
|
|
735
|
+
}
|
|
736
|
+
/>
|
|
737
|
+
<Selector
|
|
738
|
+
size="lg"
|
|
739
|
+
label="Expiry Year"
|
|
740
|
+
isRequired
|
|
741
|
+
placeholder="YY"
|
|
742
|
+
options={YEARS}
|
|
743
|
+
value={expYear}
|
|
744
|
+
onChange={setExpYear}
|
|
745
|
+
status={
|
|
746
|
+
errors.expYear
|
|
747
|
+
? { type: "error", message: errors.expYear }
|
|
748
|
+
: undefined
|
|
749
|
+
}
|
|
750
|
+
/>
|
|
751
|
+
<TextInput
|
|
752
|
+
size="lg"
|
|
753
|
+
label="CVC"
|
|
754
|
+
isRequired
|
|
755
|
+
placeholder="123"
|
|
756
|
+
value={cvc}
|
|
757
|
+
onChange={setCvc}
|
|
758
|
+
labelTooltip="3-digit security code usually found on the back of your card. American Express cards have a 4-digit code located on the front."
|
|
759
|
+
status={
|
|
760
|
+
errors.cvc ? { type: "error", message: errors.cvc } : undefined
|
|
761
|
+
}
|
|
762
|
+
/>
|
|
763
|
+
</Grid>
|
|
764
|
+
<TextInput
|
|
765
|
+
size="lg"
|
|
766
|
+
label="Name on Card"
|
|
767
|
+
isRequired
|
|
768
|
+
placeholder="Vlad Dracul"
|
|
769
|
+
value={cardName}
|
|
770
|
+
onChange={setCardName}
|
|
771
|
+
status={
|
|
772
|
+
errors.cardName
|
|
773
|
+
? { type: "error", message: errors.cardName }
|
|
774
|
+
: undefined
|
|
775
|
+
}
|
|
776
|
+
/>
|
|
777
|
+
<CheckboxInput
|
|
778
|
+
label="Use shipping address as billing address"
|
|
779
|
+
value={billingMatchesShipping}
|
|
780
|
+
onChange={setBillingMatchesShipping}
|
|
781
|
+
/>
|
|
782
|
+
{!billingMatchesShipping && (
|
|
783
|
+
<VStack gap={3}>
|
|
784
|
+
<TextInput
|
|
785
|
+
size="lg"
|
|
786
|
+
label="Address"
|
|
787
|
+
isRequired
|
|
788
|
+
placeholder="666 Castle Way"
|
|
789
|
+
value={billingAddress}
|
|
790
|
+
onChange={setBillingAddress}
|
|
791
|
+
status={
|
|
792
|
+
errors.billingAddress
|
|
793
|
+
? {
|
|
794
|
+
type: "error",
|
|
795
|
+
message: errors.billingAddress,
|
|
796
|
+
}
|
|
797
|
+
: undefined
|
|
798
|
+
}
|
|
799
|
+
/>
|
|
800
|
+
<Grid columns={isMobile ? 1 : 2} gap={3}>
|
|
801
|
+
<TextInput
|
|
802
|
+
size="lg"
|
|
803
|
+
label="City"
|
|
804
|
+
isRequired
|
|
805
|
+
placeholder="Transylvania"
|
|
806
|
+
value={billingCity}
|
|
807
|
+
onChange={setBillingCity}
|
|
808
|
+
status={
|
|
809
|
+
errors.billingCity
|
|
810
|
+
? {
|
|
811
|
+
type: "error",
|
|
812
|
+
message: errors.billingCity,
|
|
813
|
+
}
|
|
814
|
+
: undefined
|
|
815
|
+
}
|
|
816
|
+
/>
|
|
817
|
+
<TextInput
|
|
818
|
+
size="lg"
|
|
819
|
+
label="ZIP Code"
|
|
820
|
+
isRequired
|
|
821
|
+
placeholder="40000"
|
|
822
|
+
value={billingZip}
|
|
823
|
+
onChange={setBillingZip}
|
|
824
|
+
status={
|
|
825
|
+
errors.billingZip
|
|
826
|
+
? {
|
|
827
|
+
type: "error",
|
|
828
|
+
message: errors.billingZip,
|
|
829
|
+
}
|
|
830
|
+
: undefined
|
|
831
|
+
}
|
|
832
|
+
/>
|
|
833
|
+
</Grid>
|
|
834
|
+
<Selector
|
|
835
|
+
size="lg"
|
|
836
|
+
label="State"
|
|
837
|
+
isRequired
|
|
838
|
+
placeholder="Select state"
|
|
839
|
+
options={US_STATES}
|
|
840
|
+
value={billingState}
|
|
841
|
+
onChange={setBillingState}
|
|
842
|
+
status={
|
|
843
|
+
errors.billingState
|
|
844
|
+
? {
|
|
845
|
+
type: "error",
|
|
846
|
+
message: errors.billingState,
|
|
847
|
+
}
|
|
848
|
+
: undefined
|
|
849
|
+
}
|
|
850
|
+
/>
|
|
851
|
+
</VStack>
|
|
852
|
+
)}
|
|
853
|
+
</VStack>
|
|
854
|
+
</VStack>
|
|
855
|
+
|
|
856
|
+
{/* Promo Code */}
|
|
857
|
+
<VStack gap={3}>
|
|
858
|
+
<Heading level={2}>Promo code</Heading>
|
|
859
|
+
<HStack gap={2} vAlign="end">
|
|
860
|
+
<StackItem size="fill">
|
|
861
|
+
<TextInput
|
|
862
|
+
size="lg"
|
|
863
|
+
label="Promo code"
|
|
864
|
+
placeholder="Enter promo code"
|
|
865
|
+
value={promo}
|
|
866
|
+
onChange={setPromo}
|
|
867
|
+
controlStyle={fullWidth}
|
|
868
|
+
/>
|
|
869
|
+
</StackItem>
|
|
870
|
+
<Button label="Apply" variant="secondary" size="lg" onClick={() => {}} />
|
|
871
|
+
</HStack>
|
|
872
|
+
</VStack>
|
|
873
|
+
|
|
874
|
+
{/* Gift Options */}
|
|
875
|
+
<VStack gap={3}>
|
|
876
|
+
<Heading level={2}>Gift options</Heading>
|
|
877
|
+
<CheckboxInput
|
|
878
|
+
label="Add a gift message"
|
|
879
|
+
value={addGiftMessage}
|
|
880
|
+
onChange={setAddGiftMessage}
|
|
881
|
+
/>
|
|
882
|
+
{addGiftMessage && (
|
|
883
|
+
<VStack gap={3}>
|
|
884
|
+
<Grid columns={isMobile ? 1 : 2} gap={3}>
|
|
885
|
+
<TextInput
|
|
886
|
+
size="lg"
|
|
887
|
+
label="To"
|
|
888
|
+
placeholder="Recipient name"
|
|
889
|
+
value={giftTo}
|
|
890
|
+
onChange={setGiftTo}
|
|
891
|
+
/>
|
|
892
|
+
<TextInput
|
|
893
|
+
size="lg"
|
|
894
|
+
label="From"
|
|
895
|
+
placeholder="Your name"
|
|
896
|
+
value={giftFrom}
|
|
897
|
+
onChange={setGiftFrom}
|
|
898
|
+
/>
|
|
899
|
+
</Grid>
|
|
900
|
+
<TextArea
|
|
901
|
+
label="Gift message"
|
|
902
|
+
placeholder="Write something here"
|
|
903
|
+
value={giftMessage}
|
|
904
|
+
onChange={setGiftMessage}
|
|
905
|
+
/>
|
|
906
|
+
</VStack>
|
|
907
|
+
)}
|
|
908
|
+
</VStack>
|
|
909
|
+
|
|
910
|
+
{/* Trust bar + CTAs + policy links */}
|
|
911
|
+
<VStack gap={4}>
|
|
912
|
+
<TrustBar />
|
|
913
|
+
<VStack gap={2}>
|
|
914
|
+
<Button
|
|
915
|
+
label="Place order"
|
|
916
|
+
variant="primary"
|
|
917
|
+
size="lg"
|
|
918
|
+
style={fullWidth}
|
|
919
|
+
onClick={() => setSubmitted(true)}
|
|
920
|
+
/>
|
|
921
|
+
<Button
|
|
922
|
+
label="Continue shopping"
|
|
923
|
+
variant="secondary"
|
|
924
|
+
size="lg"
|
|
925
|
+
style={fullWidth}
|
|
926
|
+
onClick={() => {}}
|
|
927
|
+
/>
|
|
928
|
+
</VStack>
|
|
929
|
+
<Divider />
|
|
930
|
+
<PolicyLinks />
|
|
931
|
+
</VStack>
|
|
932
|
+
</VStack>
|
|
933
|
+
</StackItem>
|
|
934
|
+
|
|
935
|
+
<StackItem size="fill" style={isStacked ? summaryMobileOrder : summarySticky}>
|
|
936
|
+
<OrderSummaryCard
|
|
937
|
+
quantities={quantities}
|
|
938
|
+
onChangeQty={(id, v) => setQuantities((q) => ({ ...q, [id]: v }))}
|
|
939
|
+
subtotal={subtotal}
|
|
940
|
+
shipping={shipping}
|
|
941
|
+
tax={tax}
|
|
942
|
+
total={total}
|
|
943
|
+
/>
|
|
944
|
+
</StackItem>
|
|
945
|
+
</Stack>
|
|
946
|
+
</VStack>
|
|
947
|
+
</Section>
|
|
948
|
+
</Center>
|
|
949
|
+
</LayoutContent>
|
|
950
|
+
}
|
|
951
|
+
/>
|
|
952
|
+
);
|
|
1062
953
|
}
|