1# Adding to the system
2
3This board is a reference, and a reference rots the moment adding to it is
4harder than not bothering. Four steps, and a test that notices when one of
5them is skipped.
6
7## The four steps
8
9**1. Add a row to `catalog.ts`.**
10
11Start with README.md for usage guidance. This document covers additions
12to the shared production catalog, not legacy Sanity block publishing.
13
14```ts
15{
16 slug: 'stat-row',
17 name: 'Stat Row',
18 path: 'src/components/brand-system/components.tsx',
19 group: 'Modules',
20 live: true,
21}
22```
23
24`slug` is the URL segment and the default name of its doc. `path` is where
25the thing actually lives, shown in the header. Position in the array is
26position in the rail. `live: false` means the entry is prose only — its
27doc takes the full width instead of sharing with a specimen.
28
29**2. Register the render in `[slug]/renders.tsx`.**
30
31Skip this for a `live: false` guideline. Everything else maps its slug to
32a render:
33
34```tsx
35'stat-row': {
36 build: () => ({ render: <StatRow stats={…} /> }),
37},
38```
39
40An entry can declare `axes` instead, and the board builds a toggle per
41axis. Use axes when a component genuinely varies — layout, size, state —
42rather than to show two sets of sample copy.
43
44**3. Write `docs/<slug>.md`.**
45
46There is no required shape, but the ones worth reading answer four
47questions: what it is, when to reach for it, when not to, and which rules
48it answers to. Say what was decided and why; the why is the part nobody
49can reconstruct later.
50
51**Hard wrap at about 72 characters.** The board shows these as markdown
52source with real line numbers rather than as rendered output, so one
53number is one line of the file and a number here points at the same line
54in the repo. An unwrapped paragraph puts a single number against six
55screen lines and the gutter stops meaning anything.
56
57An entry with no doc renders a visible "not written yet" state rather
58than an empty pane. That is deliberate — the gaps are the backlog, and
59they should be legible from the rail instead of discovered one click at a
60time.
61
62**4. Run `pnpm test:brand`, typecheck, lint and relevant behavior tests.**
63
64Implement approved modules in `src/components/brand-system/`, expose the
65appropriate shared API, and add these catalog pieces in the same change.
66Do not register a module in Sanity unless it also participates in the
67legacy block renderer. Before release, run the full non-live-audit suite
68and `pnpm build`, then verify the actual page preview.
69
70## What the test checks
71
72`__tests__/catalog.test.ts` asserts the three places an entry exists stay
73in step:
74
75- every slug is unique
76- every entry has a doc, or the test tells you which one does not
77- every markdown file in `docs/` belongs to an entry, so deleting an entry
78 does not leave an orphan behind
79- every `live` entry has a render registered, and every registered render
80 has a catalogue row
81
82Each of those is a different flavour of broken — a dead rail link, an
83unreachable specimen, an empty pane, a file nobody reads — and all four
84are easy to half-do at five o'clock.
85
86
87## Brand and visual guidelines
88
89The **Guidelines** rail group holds visual references alongside their
90authoring guidance:
91
92- [tokens.css](/brand-workshop/system/tokens) — the current visual values
93 and the deliberately small MVP token strategy. Proposed extractions
94 are labeled separately from implemented tokens.
95- [typography.md](/brand-workshop/system/typography) — the two font families,
96 seven responsive roles, weights, hierarchy and sentence-case guidance.
97- [color.md](/brand-workshop/system/color) — ink, action-color and surface
98 roles, including the Yield demo path.
99- [effects.md](/brand-workshop/system/effects) — interaction, focus and
100 control-treatment guidance.
101- [layout.md](/brand-workshop/system/layout) — columns, rhythm and the
102 distinction between square containers and compact action controls.
103- [motion.md](/brand-workshop/system/motion) and
104 [graphic-elements.md](/brand-workshop/system/graphic-elements) — current
105 interaction and decorative-ground behavior.
106
107Both preview Light and Inverted using the actual CSS variables, not a
108second set of swatch or type values. Keep their examples aligned with
109tokens.css. The references do not introduce a token generation pipeline.
110
111The current set covers the implemented shared system. Brand / verbal,
112brandmark and art direction should be added when their actual guidance is
113available, not filled with invented policy.
114
115## Source files
116
117- `catalog.ts` — what exists, in rail order. No JSX: the rail is a client
118 component and has to be able to import it.
119- `[slug]/renders.tsx` — the specimens. The one module that holds
120 components.
121- `README.md` — repository source map and task-based reading paths.
122- `docs/building-with-the-system.md` — the `/brand/start` entry.
123- `docs/adding.md` — these contribution instructions.
124- `docs/*.md` — the prose.
125- `RULES.md` — the numbered design rules. Rules are never renumbered; a
126 rule that changes is marked superseded and the replacement gets a new
127 number, so a decision made months ago can still be read in the form it
128 was made.
129- `src/components/brand-system/tokens.css` — canonical shared values.
130- `src/components/brand-system/components.css` — canonical shared `w-`
131 rules, scoped to `[data-ds='warp-next']`.
132- `src/app/brand-workshop/system/*.tsx` — compatibility forwards for the
133 board; new primitives belong in the shared production layer.
134- `board.css` — the board's own chrome, prefixed `ws-`. It selects nothing
135 inside a specimen, and it must stay that way: a board that restyles the
136 thing it is showing is lying to you.
137
138## A note on the scope
139
140Everything in the system renders inside `[data-ds='warp-next']`. New
141marketing pages use it by default; shared changes also reach every
142migrated production consumer. The scope keeps unmigrated pages isolated.
143The canonical browser catalog is `/brand`; workshop URLs remain
144compatibility aliases.