@spunto/brand-kit 0.7.0 → 0.8.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/package.json +1 -1
- package/src/home/check.ts +14 -0
- package/src/home/editions/cms.json +394 -0
- package/src/home/guide.ts +16 -0
- package/src/home/home.tsx +45 -0
- package/src/home/index.ts +2 -0
- package/src/home/showcase/catalog.ts +62 -0
- package/src/home/showcase/cms/board.tsx +162 -0
- package/src/home/showcase/cms/page.tsx +169 -0
- package/src/home/showcase/cms/parts.tsx +130 -0
- package/src/home/showcase/cms/sample.ts +172 -0
- package/src/home/showcase/cms/table.tsx +207 -0
- package/src/home/showcase/cms/views.tsx +166 -0
- package/src/home/showcase/stage.tsx +328 -0
- package/src/home/showcase/view.tsx +30 -0
- package/src/home/types.ts +17 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState, type CSSProperties, type ReactNode, type RefObject } from "react"
|
|
4
|
+
import { FONT, hexAlpha } from "../../theme"
|
|
5
|
+
|
|
6
|
+
/* The stage a showcase screen plays on — what every screen shares.
|
|
7
|
+
|
|
8
|
+
A screen is drawn on a board 920 design pixels wide. `u(n)` is n of those pixels: the stage is an
|
|
9
|
+
inline-size container and sets `--u` from its own width, so the same drawing fills a 1060 px band,
|
|
10
|
+
a 700 px column or a phone. Below a legible size it stops shrinking: the board is then wider than
|
|
11
|
+
the stage, and the scroll pans across it.
|
|
12
|
+
|
|
13
|
+
Two clocks, neither of which costs a render when nobody looks:
|
|
14
|
+
- the scroll writes `--p` on the stage (0 as it comes in from the bottom, 0.5 in the middle, 1 as
|
|
15
|
+
it leaves by the top). Layers read it in CSS: the window rises in, the cards floating over it
|
|
16
|
+
drift at their own depth — the parallax;
|
|
17
|
+
- the scene's steps (a cursor goes to a card, takes it, drops it…) advance on a timer only while
|
|
18
|
+
the stage is on screen, and loop.
|
|
19
|
+
|
|
20
|
+
The server draws step 0 with `--p` at 0.5: a whole, still screen. Under prefers-reduced-motion it
|
|
21
|
+
stays still, on the step the scene chose to tell its story (`still`). */
|
|
22
|
+
|
|
23
|
+
export const BOARD = 920
|
|
24
|
+
/** The smallest design pixel, in CSS pixels: under it the app's text stops being readable. */
|
|
25
|
+
const MIN_U = 0.72
|
|
26
|
+
|
|
27
|
+
/** `n` design pixels. */
|
|
28
|
+
export const u = (n: number) => `calc(var(--u) * ${n})`
|
|
29
|
+
|
|
30
|
+
export const INK = "#121b17"
|
|
31
|
+
export const MUTED = "#56605b"
|
|
32
|
+
export const FAINT = "#8a938e"
|
|
33
|
+
export const LINE = "#dce1de"
|
|
34
|
+
export const WASH = "#f3f6f4"
|
|
35
|
+
export const PAPER = "#fbfcfb"
|
|
36
|
+
|
|
37
|
+
export type StageColors = { field: string; signal: string; tone: string }
|
|
38
|
+
|
|
39
|
+
function useReducedMotion() {
|
|
40
|
+
const [reduced, set] = useState(false)
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (!window.matchMedia) return
|
|
43
|
+
const q = window.matchMedia("(prefers-reduced-motion: reduce)")
|
|
44
|
+
const on = () => set(q.matches)
|
|
45
|
+
on()
|
|
46
|
+
q.addEventListener("change", on)
|
|
47
|
+
return () => q.removeEventListener("change", on)
|
|
48
|
+
}, [])
|
|
49
|
+
return reduced
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** `near`: about to be on screen (the scroll is read); `on`: a good part of it is (the scene plays). */
|
|
53
|
+
function useOnScreen(ref: RefObject<HTMLElement | null>) {
|
|
54
|
+
const [state, set] = useState({ near: false, on: false })
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const el = ref.current
|
|
57
|
+
if (!el || typeof IntersectionObserver === "undefined") return
|
|
58
|
+
const io = new IntersectionObserver(
|
|
59
|
+
([e]) => set({ near: e.isIntersecting, on: e.isIntersecting && e.intersectionRatio >= 0.3 }),
|
|
60
|
+
{ rootMargin: "240px 0px", threshold: [0, 0.3] },
|
|
61
|
+
)
|
|
62
|
+
io.observe(el)
|
|
63
|
+
return () => io.disconnect()
|
|
64
|
+
}, [ref])
|
|
65
|
+
return state
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function useScrollProgress(ref: RefObject<HTMLElement | null>, enabled: boolean) {
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const el = ref.current
|
|
71
|
+
if (!el || !enabled) return
|
|
72
|
+
let frame = 0
|
|
73
|
+
const read = () => {
|
|
74
|
+
frame = 0
|
|
75
|
+
const r = el.getBoundingClientRect()
|
|
76
|
+
const vh = window.innerHeight || 1
|
|
77
|
+
el.style.setProperty("--p", Math.min(1, Math.max(0, (vh - r.top) / (vh + r.height))).toFixed(4))
|
|
78
|
+
}
|
|
79
|
+
const ask = () => {
|
|
80
|
+
if (!frame) frame = requestAnimationFrame(read)
|
|
81
|
+
}
|
|
82
|
+
read()
|
|
83
|
+
// Capture: the page may scroll in a box (the studio's preview) rather than in the window.
|
|
84
|
+
document.addEventListener("scroll", ask, { capture: true, passive: true })
|
|
85
|
+
window.addEventListener("resize", ask)
|
|
86
|
+
return () => {
|
|
87
|
+
if (frame) cancelAnimationFrame(frame)
|
|
88
|
+
document.removeEventListener("scroll", ask, { capture: true })
|
|
89
|
+
window.removeEventListener("resize", ask)
|
|
90
|
+
}
|
|
91
|
+
}, [ref, enabled])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** A scene's clock: `lengths[i]` is how long step i lasts (ms). Loops while playing, holds its step otherwise. */
|
|
95
|
+
function useSteps(lengths: readonly number[], playing: boolean) {
|
|
96
|
+
const [step, set] = useState(0)
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!playing) return
|
|
99
|
+
const id = setTimeout(() => set((s) => (s + 1) % lengths.length), lengths[step])
|
|
100
|
+
return () => clearTimeout(id)
|
|
101
|
+
}, [step, playing, lengths])
|
|
102
|
+
return step
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Everything a scene needs: the stage's ref, and the step to draw. */
|
|
106
|
+
export function useStage(lengths: readonly number[], still: number) {
|
|
107
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
108
|
+
const reduced = useReducedMotion()
|
|
109
|
+
const { near, on } = useOnScreen(ref)
|
|
110
|
+
useScrollProgress(ref, near && !reduced)
|
|
111
|
+
const step = useSteps(lengths, on && !reduced)
|
|
112
|
+
return { ref, step: reduced ? still : step }
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const vars = (v: Record<string, string | number>) => v as CSSProperties
|
|
116
|
+
|
|
117
|
+
export function Stage({ stageRef, colors, night, height, label, children }: { stageRef: RefObject<HTMLDivElement | null>; colors: StageColors; night: boolean; height: number; label: string; children: ReactNode }) {
|
|
118
|
+
// On paper the screen sits in a panel of the product's field; on a field-coloured band, in a lighter pane of it.
|
|
119
|
+
const panel = night ? hexAlpha("#ffffff", 0.07) : colors.field
|
|
120
|
+
return (
|
|
121
|
+
<div ref={stageRef} data-showcase-stage role="img" aria-label={label} style={{ position: "relative", containerType: "inline-size", ...vars({ "--p": 0.5 }) }}>
|
|
122
|
+
<div
|
|
123
|
+
aria-hidden
|
|
124
|
+
style={{
|
|
125
|
+
// Never taller than most of the screen it is read on: the board then sits centred in a wider panel.
|
|
126
|
+
...vars({ "--u": `clamp(${MIN_U}px, calc(100cqi / ${BOARD}), calc(84vh / ${height}))` }),
|
|
127
|
+
position: "relative",
|
|
128
|
+
height: u(height),
|
|
129
|
+
overflow: "hidden",
|
|
130
|
+
borderRadius: 8,
|
|
131
|
+
background: panel,
|
|
132
|
+
border: night ? "1px solid rgba(255,255,255,0.12)" : "none",
|
|
133
|
+
color: INK,
|
|
134
|
+
fontFamily: FONT.sans,
|
|
135
|
+
fontSize: u(12),
|
|
136
|
+
lineHeight: 1.35,
|
|
137
|
+
textAlign: "left",
|
|
138
|
+
userSelect: "none",
|
|
139
|
+
cursor: "default",
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<div
|
|
143
|
+
style={{
|
|
144
|
+
position: "absolute",
|
|
145
|
+
inset: "-20%",
|
|
146
|
+
background: `radial-gradient(42% 46% at 78% 22%, ${hexAlpha(colors.signal, night ? 0.2 : 0.34)}, transparent 70%), radial-gradient(40% 50% at 12% 92%, ${hexAlpha(colors.signal, night ? 0.1 : 0.16)}, transparent 70%)`,
|
|
147
|
+
transform: "translateY(calc((var(--p) - 0.5) * 12%))",
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
<div
|
|
151
|
+
style={{
|
|
152
|
+
position: "absolute",
|
|
153
|
+
top: 0,
|
|
154
|
+
left: 0,
|
|
155
|
+
width: u(BOARD),
|
|
156
|
+
height: "100%",
|
|
157
|
+
// Room to spare: centred. Too narrow: the scroll pans from the board's left edge to its right one.
|
|
158
|
+
transform: `translateX(calc(max(0px, 100cqi - ${u(BOARD)}) * 0.5 + min(0px, 100cqi - ${u(BOARD)}) * clamp(0, (var(--p) - 0.32) * 2.8, 1)))`,
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
{children}
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** The app's window. It rises in as the stage enters the screen. */
|
|
169
|
+
export function AppWindow({ x, y, w, h, address, children }: { x: number; y: number; w: number; h: number; address: string; children: ReactNode }) {
|
|
170
|
+
return (
|
|
171
|
+
<div
|
|
172
|
+
style={{
|
|
173
|
+
position: "absolute",
|
|
174
|
+
left: u(x),
|
|
175
|
+
top: u(y),
|
|
176
|
+
width: u(w),
|
|
177
|
+
height: u(h),
|
|
178
|
+
borderRadius: `${u(9)} ${u(9)} 0 0`,
|
|
179
|
+
background: PAPER,
|
|
180
|
+
overflow: "hidden",
|
|
181
|
+
boxShadow: `0 ${u(30)} ${u(70)} ${u(-18)} rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.08)`,
|
|
182
|
+
transform: `translateY(calc(clamp(0, (0.3 - var(--p)) * 4, 1) * ${u(46)}))`,
|
|
183
|
+
opacity: "clamp(0, calc((var(--p) - 0.04) * 7), 1)",
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<div style={{ height: u(26), display: "flex", alignItems: "center", gap: u(5), padding: `0 ${u(10)}`, background: "#eef1ef", borderBottom: `1px solid ${LINE}` }}>
|
|
187
|
+
{[0, 1, 2].map((i) => (
|
|
188
|
+
<span key={i} style={{ width: u(7), height: u(7), borderRadius: "50%", background: "#cdd3cf" }} />
|
|
189
|
+
))}
|
|
190
|
+
<span style={{ margin: "0 auto", padding: `${u(2)} ${u(26)}`, borderRadius: u(4), background: "#ffffff", fontFamily: FONT.mono, fontSize: u(9), color: MUTED, transform: `translateX(${u(-16)})` }}>{address}</span>
|
|
191
|
+
</div>
|
|
192
|
+
<div style={{ position: "relative", height: `calc(100% - ${u(26)})` }}>{children}</div>
|
|
193
|
+
</div>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** A card floating over the window: it drifts with the scroll at its own `depth`, appears as the stage comes in, and — when
|
|
198
|
+
the scene says so (`show`) — pops in on a step. */
|
|
199
|
+
export function Float({ x, y, w, depth, show = true, children, style }: { x: number; y: number; w: number; depth: number; show?: boolean; children: ReactNode; style?: CSSProperties }) {
|
|
200
|
+
return (
|
|
201
|
+
<div
|
|
202
|
+
style={{
|
|
203
|
+
position: "absolute",
|
|
204
|
+
left: u(x),
|
|
205
|
+
top: u(y),
|
|
206
|
+
width: u(w),
|
|
207
|
+
zIndex: 4,
|
|
208
|
+
transform: `translateY(calc((0.5 - var(--p)) * ${u(depth)}))`,
|
|
209
|
+
opacity: "clamp(0, calc((var(--p) - 0.14) * 6), 1)",
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
<div
|
|
213
|
+
style={{
|
|
214
|
+
borderRadius: u(8),
|
|
215
|
+
boxShadow: `0 ${u(22)} ${u(48)} ${u(-14)} rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.08)`,
|
|
216
|
+
opacity: show ? 1 : 0,
|
|
217
|
+
transform: show ? "none" : `translateY(${u(14)}) scale(0.96)`,
|
|
218
|
+
transition: "opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25)",
|
|
219
|
+
overflow: "hidden",
|
|
220
|
+
...style,
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
{children}
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** A dark card of code: a request, a payload. `lines` are printed as they are; one can be lit (`hot`) or held back (`hidden`). */
|
|
230
|
+
export function CodeCard({ title, meta, lines, signal }: { title: string; meta?: string; lines: { text: string; hot?: boolean; hidden?: boolean }[]; signal: string }) {
|
|
231
|
+
return (
|
|
232
|
+
<div style={{ background: "#151019", color: "#e9e4ec" }}>
|
|
233
|
+
<div style={{ display: "flex", alignItems: "center", gap: u(7), padding: `${u(8)} ${u(12)}`, borderBottom: "1px solid rgba(255,255,255,0.1)", fontSize: u(10.5), fontWeight: 600 }}>
|
|
234
|
+
<span style={{ width: u(6), height: u(6), borderRadius: "50%", background: signal }} />
|
|
235
|
+
{title}
|
|
236
|
+
{meta && <span style={{ marginLeft: "auto", fontFamily: FONT.mono, fontWeight: 400, fontSize: u(9), color: "rgba(255,255,255,0.55)" }}>{meta}</span>}
|
|
237
|
+
</div>
|
|
238
|
+
<pre style={{ margin: 0, padding: `${u(9)} 0 ${u(11)}`, fontFamily: FONT.mono, fontSize: u(9.4), lineHeight: 1.62, whiteSpace: "pre", overflow: "hidden" }}>
|
|
239
|
+
{lines.map((l, i) => (
|
|
240
|
+
<div
|
|
241
|
+
key={i}
|
|
242
|
+
style={{
|
|
243
|
+
padding: `0 ${u(12)}`,
|
|
244
|
+
maxHeight: l.hidden ? 0 : u(18),
|
|
245
|
+
opacity: l.hidden ? 0 : 1,
|
|
246
|
+
background: l.hot ? hexAlpha(signal, 0.16) : "transparent",
|
|
247
|
+
color: l.hot ? signal : undefined,
|
|
248
|
+
boxShadow: l.hot ? `inset ${u(2)} 0 0 ${signal}` : "none",
|
|
249
|
+
transition: "background 0.4s ease, color 0.4s ease, max-height 0.4s ease, opacity 0.4s ease",
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
{l.text || " "}
|
|
253
|
+
</div>
|
|
254
|
+
))}
|
|
255
|
+
</pre>
|
|
256
|
+
</div>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** The pointer. Positions are the window's design pixels. */
|
|
261
|
+
export function Cursor({ x, y, down, hidden, ms = 700 }: { x: number; y: number; down?: boolean; hidden?: boolean; ms?: number }) {
|
|
262
|
+
return (
|
|
263
|
+
<div
|
|
264
|
+
style={{
|
|
265
|
+
position: "absolute",
|
|
266
|
+
left: 0,
|
|
267
|
+
top: 0,
|
|
268
|
+
zIndex: 9,
|
|
269
|
+
transform: `translate(${u(x)}, ${u(y)})`,
|
|
270
|
+
opacity: hidden ? 0 : 1,
|
|
271
|
+
transition: `transform ${ms}ms cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.3s ease`,
|
|
272
|
+
pointerEvents: "none",
|
|
273
|
+
}}
|
|
274
|
+
>
|
|
275
|
+
<svg viewBox="0 0 20 22" style={{ display: "block", width: u(17), height: u(19), transform: down ? "scale(0.86)" : "none", transformOrigin: "0 0", transition: "transform 0.15s ease", filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.35))" }}>
|
|
276
|
+
<path d="M2 1.5v16l4.4-4 2.9 6.6 2.9-1.3-2.9-6.4h6.2z" fill="#111" stroke="#fff" strokeWidth="1.5" strokeLinejoin="round" />
|
|
277
|
+
</svg>
|
|
278
|
+
</div>
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Line icons (24 × 24, drawn as strokes), sized in design pixels. */
|
|
283
|
+
const ICON = {
|
|
284
|
+
board: "M4 4h16v16H4zM9 8v8M15 8v5",
|
|
285
|
+
table: "M4 4h16v16H4zM4 10h16M10 4v16",
|
|
286
|
+
list: "M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01",
|
|
287
|
+
sliders: "M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4",
|
|
288
|
+
plus: "M12 5v14M5 12h14",
|
|
289
|
+
status: "M12 3a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM12 11.5a.5.5 0 1 0 0 1a.5.5 0 0 0 0-1z",
|
|
290
|
+
select: "M12 3a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM8.5 11l3.5 3.5l3.5-3.5",
|
|
291
|
+
tag: "M3 3h8l10 10l-8 8L3 11zM7.5 7.5h.01",
|
|
292
|
+
calendar: "M4 6h16v15H4zM4 10.5h16M8 3v5M16 3v5",
|
|
293
|
+
person: "M12 4a4 4 0 1 0 0 8a4 4 0 0 0 0-8zM5 21a7 7 0 0 1 14 0",
|
|
294
|
+
people: "M9 5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 0 0 0-7zM3 20a6 6 0 0 1 12 0M16 5.4a3.5 3.5 0 0 1 0 6.3M18 14.6a6 6 0 0 1 3 5.4",
|
|
295
|
+
number: "M5 9h15M4 15h15M10 4L8 20M16 4l-2 16",
|
|
296
|
+
text: "M5 6V4h14v2M12 4v16M9 20h6",
|
|
297
|
+
globe: "M12 3a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18",
|
|
298
|
+
check: "M5 12.5l4.5 4.5L19 7.5",
|
|
299
|
+
chevron: "M6 9l6 6l6-6",
|
|
300
|
+
columns: "M4 4h16v16H4zM9.5 4v16M14.5 4v16",
|
|
301
|
+
} as const
|
|
302
|
+
|
|
303
|
+
export type IconId = keyof typeof ICON
|
|
304
|
+
|
|
305
|
+
export function Icon({ id, size = 12, color = "currentColor", width = 1.8, style }: { id: IconId; size?: number; color?: string; width?: number; style?: CSSProperties }) {
|
|
306
|
+
return (
|
|
307
|
+
<svg viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth={width} strokeLinecap="round" strokeLinejoin="round" style={{ display: "block", flexShrink: 0, width: u(size), height: u(size), ...style }}>
|
|
308
|
+
<path d={ICON[id]} />
|
|
309
|
+
</svg>
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** `**bold**` runs of a block's text. */
|
|
314
|
+
export function Rich({ text }: { text: string }) {
|
|
315
|
+
return (
|
|
316
|
+
<>
|
|
317
|
+
{text.split("**").map((part, i) =>
|
|
318
|
+
i % 2 ? (
|
|
319
|
+
<strong key={i} style={{ fontWeight: 650 }}>
|
|
320
|
+
{part}
|
|
321
|
+
</strong>
|
|
322
|
+
) : (
|
|
323
|
+
part
|
|
324
|
+
),
|
|
325
|
+
)}
|
|
326
|
+
</>
|
|
327
|
+
)
|
|
328
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from "react"
|
|
4
|
+
import type { BrandProductId } from "../../products"
|
|
5
|
+
import { surface, type BrandPalette, type BrandTheme } from "../../theme"
|
|
6
|
+
import type { ShowcaseScreenId } from "./catalog"
|
|
7
|
+
import { BoardScreen } from "./cms/board"
|
|
8
|
+
import { PageScreen } from "./cms/page"
|
|
9
|
+
import { TableScreen } from "./cms/table"
|
|
10
|
+
import { ViewsScreen } from "./cms/views"
|
|
11
|
+
import type { StageColors } from "./stage"
|
|
12
|
+
|
|
13
|
+
/* The client half of a `showcase` section: the home (drawn on the server) hands a screen's id and what
|
|
14
|
+
it needs to colour itself; the screen plays here. */
|
|
15
|
+
|
|
16
|
+
type ScreenProps = { lang: "en" | "fr"; colors: StageColors; night: boolean; label: string }
|
|
17
|
+
|
|
18
|
+
const SCREENS: Record<ShowcaseScreenId, (props: ScreenProps) => ReactNode> = {
|
|
19
|
+
"cms-board": BoardScreen,
|
|
20
|
+
"cms-table": TableScreen,
|
|
21
|
+
"cms-page": PageScreen,
|
|
22
|
+
"cms-views": ViewsScreen,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function ShowcaseScreen({ screen, locale, product, theme, palette, label }: { screen: ShowcaseScreenId; locale: "en" | "fr"; product: BrandProductId; theme: BrandTheme; palette?: BrandPalette; label: string }) {
|
|
26
|
+
const Screen = SCREENS[screen]
|
|
27
|
+
if (!Screen) return null
|
|
28
|
+
const s = surface(product, theme, palette)
|
|
29
|
+
return <Screen lang={locale} colors={{ field: s.field, signal: s.signal, tone: s.tone }} night={theme === "night"} label={label} />
|
|
30
|
+
}
|
package/src/home/types.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { IllustrationId } from "../illustrations/catalog"
|
|
|
14
14
|
import type { Words } from "../facts"
|
|
15
15
|
import type { Module3DRef } from "../three/catalog"
|
|
16
16
|
import type { MarkId } from "../marks"
|
|
17
|
+
import type { ShowcaseScreenId } from "./showcase/catalog"
|
|
17
18
|
|
|
18
19
|
export type { Words }
|
|
19
20
|
|
|
@@ -51,6 +52,22 @@ export type HomeSection =
|
|
|
51
52
|
lede?: Words
|
|
52
53
|
items: { illustration?: IllustrationId; title: Words; text: Words }[]
|
|
53
54
|
})
|
|
55
|
+
| (Base & {
|
|
56
|
+
/** The product at work, under the hero: each stop is a few words beside a screen of the product,
|
|
57
|
+
redrawn by the kit and playing (showcase/catalog.ts) — a card dragged on a board, a cell
|
|
58
|
+
edited in a table. A screen belongs to a product: an edition only shows its own. */
|
|
59
|
+
kind: "showcase"
|
|
60
|
+
title?: Words
|
|
61
|
+
lede?: Words
|
|
62
|
+
stops: {
|
|
63
|
+
kicker?: Words
|
|
64
|
+
title: Words
|
|
65
|
+
text: Words
|
|
66
|
+
screen: ShowcaseScreenId
|
|
67
|
+
/** `split` (default): words beside the screen, sides alternating. `wide`: words above, the screen across the page. */
|
|
68
|
+
layout?: "split" | "wide"
|
|
69
|
+
}[]
|
|
70
|
+
})
|
|
54
71
|
| (Base & {
|
|
55
72
|
kind: "roster"
|
|
56
73
|
title?: Words
|