Repository navigation
feat(react-checkout): restyle the app on the Whatsaaaa design system - #4
Merged
Merged
Conversation
The design system comes from npm like any other package, and needs Node 22.18 or 24.12, so the app's engines follow it. Shiki highlights code in the design system's code theme.
The page is the design system's window, as in the Vue app: a tab bar with form-builder's mark, a link to its docs and the ghost, and a status line with the mode, the theme switch and the switch for the shortcut keys. The fields, buttons, groups, notices and code block are the Vue app's, ported to React. Every color, font, size, space, radius and border comes from a design system token, in both themes. What the Vue app does not have: the checkout's sections are titled parts of the page, side by side on a wide screen and one under the other on a phone; the language switch is a pair of buttons that share an edge; the order summary lists its amounts on the right; a server's rejection is a message over the order button, in the voice of a field's error. The loading line is StatusMessage now, as StatusLine is the window's. On a 320 px screen the status line keeps the mode, the keys switch and the theme's name whole, with the keys on or off: the path shrinks behind its ellipsis and then goes. Shiki is loaded on its own, so the first render does not wait for it and no chunk is over Vite's 500 kB warning.
The window, its bars and its code block hide what is wider than they are, so the check for sideways overflow measures them too, not only the page: without it, a row of the page that was wider than a phone passed. At 320 px the status line keeps its working items whole with the keys on and off, and the theme and keys switches work and are remembered.
The path's box is a size container that takes the room the mode, the keys switch and the theme's name leave. The path's text, with its fill and padding, shrinks behind its ellipsis in it, and goes, padding and all, once the box has no room for "~…" between the paddings: no glyph is cut through at any width, and there is still no breakpoint but the design system's. The end-to-end check sweeps 320 to 400 px in 2 px steps, in both themes with the keys on and off, and fails on a path without the query.
The status line's path is the design system's again, in a box of the app's own that takes the room left in the line and is a size container: the path shrinks to its ellipsis in it, and is hidden as a whole once "~…" and its padding no longer fit. It is the Vue app's rule, so both apps' status lines behave the same, and the end-to-end check is the Vue app's too: from 320 to 400 px, with the keys on and off, the path never shows a cut glyph, never runs into the keys switch, and hides only when it must. In forced colors the browser paints every background in the page's color, so a checked box, the pressed language and the marks drawn as masks take the system's colors instead. A new check fails when the pressed language or a ticked box looks like the others there.
The React app is restyled too now, so it needs the design system's Node 22.18 or 24.12 like the Vue app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Restyle the sample apps on the Whatsaaaa design system, installed from npm like any user would. The apps were built plain on purpose as a docs-only trial of form-builder, with everything visual kept in each app's
src/uifolder andsrc/styles.cssso the look could be swapped later.This pull request restyles the React app,
react-checkout, following the look settled in the Vue app's restyle (#3), so the two apps read as siblings.What Changed
react-checkoutnow installs@whatsaaaa/design-system0.1.1 and Shiki from npm. Its Node engine moves to^22.18.0 || >=24.12.0to match the design system. A Vite plugin inlines the system's theme and shortcut-key init scripts in the<head>, so a saved theme and a saved "keys off" setting apply before the first paint. The app also gets new favicons and an apple-touch icon.The page now sits in the design system's terminal frame, matching the Vue app:
TabBarshows the form-builder mark for each theme, a docs link and the ghost.StatusLinehas a NORMAL/INSERT mode, a~/react-checkoutpath that shows whole or not at all, a theme switch (thetkey or the theme name) and a shortcut-keys switch.LanguageSwitchin the header. The loading line becomesStatusMessage.src/styles.cssis rewritten on the design system's tokens. It covers dark and light themes, narrow screens and forced colors.The placed order now shows in the design system's code block, captioned
order.json. It is highlighted with the system's Shiki code theme, loaded lazily, and stays plain text if the highlighter fails to load. New Playwright specs (frame.spec.ts, shared helpers inchecks.ts) and additions tocheckout.spec.tscover:The README now says both apps are restyled and both need Node 22.18+ or 24.12+.
🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is a well-bounded restyle of the React app's src/ui, stylesheet and tests that mirrors the already-reviewed Vue sibling; the three round-1 fixes are correct and minimal, and no new defect, regression or intent conflict was found.
Testing
I rebuilt react-checkout withpnpm build, served it on localhost:4275 with its own server and drove it in Chromium through two Playwright scripts, saving screenshots to the evidence round2 folder. Scenarios covered: - Desktop in light and dark: empty form, field errors, and a placed order with highlighted JSON. - Theme switch and shortcut-keys switch, both remembered after a reload. - 320 and 390 px screens in both themes: German text, server-side errors, and the placed order, with zero sideways overflow. - The "Place order" button while the order is being sent, with the pointer on it and away from it. - The order shown with the highlighter file blocked. - Forced colors on a light and a dark system: each language pressed in turn, the terms box ticked, and a pixel count of each label's text. - A runtime mutant that removesforced-color-adjust: nonefrom the pressed-language rule. The label's text pixel count drops from 2143 to 0, the same blank plate seen in round 1. I also ran the app's two e2e specs, which this change edited, against a fresh production build on desktop and mobile Chromium. 45 passed, and 1 was skipped on purpose: the t-key test is marked to skip on mobile. Every scenario passed. I stopped the server and removed dist and test-results.Evidence: Forced colors computed styles, label pixel counts and mutant results
Evidence: Captured states: overflow, theme and keys after reload, button styles, highlighter fallback
Evidence: Playwright e2e run (frame and checkout specs, desktop and mobile)
45 passed, 1 skipped (t-key test, skipped on mobile on purpose), EXIT=0Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed ✅
react-checkout/src/styles.css:660- Disabled buttons still pick up their hover look. Both.button:disabled(lines 526-533, specificity 0,2,0) and the hover rules have the same specificity, and the hover rules come later in the file:.button:hoverat line 648 and.button--primary:hoverat line 660. Chromium matches:hoveron disabled buttons, so the later hover rules win. How a user hits it: they click "Place order" with the mouse, andCheckoutForm.tsx:124disables the button while the POST runs. The pointer is still over it, so.button--primary:hoverbrings back the interactive fill and border, while.button:disabledkeeps the text at--ws-color-text-faint. The result is faint, low-contrast "Placing your order..." text on the interactive fill, which looks clickable but shows a not-allowed cursor, in both themes. This is a regression: the old stylesheet dimmed the whole button withopacity: 0.7. The Vue app has the same rule order, but nothing there is ever disabled, so it never showed. Fix: limit both hover rules to enabled buttons (.button:enabled:hover,.button--primary:enabled:hover), or move the:disabledblock after the button hover rules..input:hover(388) and.choice__input:hover(501) already come before the disabled rule, so they are fine.react-checkout/e2e/frame.spec.ts:164- The forced-colors test probably cannot catch the bug it is named for (likely, not certain: it depends on Chromium internals, and tests were not run in this review). It only checks that English's computed background differs from Deutsch's. Deutsch's background isnone(transparent) and the pressed button's is opaque. Chromium's forced-colors mode keeps the alpha channel ofbackground-color, so the two strings likely differ even without the.language__button[aria-pressed='true'] { background: Highlight }rule at styles.css:821. The bug the test should catch: without that rule, the pressed language paints in Canvas, the same color as the page, so it looks no different from the other button, and the test still passes. A better oracle is the CSS system colorHighlight(CSS Color 4). Resolve it with a probe element styledbackground: Highlight, then assert that English's background equals it and Deutsch's does not. Do the same for the ticked checkbox at lines 168-172 (ticked equals the Highlight probe, unticked does not), so both parts of the test fail if the forced-colors rules are removed.react-checkout/src/ui/CodeBlock.tsx:16- The lazy-loaded Shiki chunk has no failure handling. Ifimport('./highlight')fails (for example a flaky network at page load), the module-levelloadingpromise rejects with no handler. Each mounted CodeBlock then adds another unhandled rejection throughvoid loading.then(...)at line 41. The order still shows in plain text, which is the intended fallback, but the console logs 'Uncaught (in promise)' errors and the fallback only works by accident. Fix: add.catch(() => undefined)toloading, and skipsetHighlightwhen the result is undefined, so plain text is an explicit result. The split itself is justified: the restyle commit says it keeps every chunk under Vite's 500 kB warning.🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Test** - 2 issues found → auto-fixed ✅
react-checkout/src/styles.css:821- In forced colors, the pressed language button's label can't be read. The forced-colors rule.choice__input:checked, .language__button[aria-pressed='true'] { border-color: Highlight; color: HighlightText; background: Highlight }(added by commit 5809292) keepsforced-color-adjust: auto. Chromium therefore paints its Canvas-colored readability backplate behind the button's text. In the forced palettes, Canvas has the same color as HighlightText: light is Canvas rgb(255,255,255) and HighlightText rgb(255,255,255), dark is rgb(0,0,0) for both. So "English" (or "Deutsch" once pressed) is drawn as a blank plate on the Highlight fill, as seen in forced-colors-light-language-zoom.png and forced-colors-dark-language-zoom.png. A plain control button with the same colors shows the same thing. Before this change the app had no such rule, and the browser painted the label in ButtonText, which was readable. The e2e test 'tells the pressed language and a ticked box from the others' (e2e/frame.spec.ts:157) still passes because it only checks the button's background color, not the legibility of its text. The ticked checkbox is not affected because it has no text. Fix, verified by injecting it at runtime (forced-colors-*-language-with-candidate-fix.png): inside the@media (forced-colors: active)block, give.language__button[aria-pressed='true']the declarationforced-color-adjust: none(its colors are already system colors, so the user's palette still applies). A test that fails before the fix should also be added, for example one that checks the pressed button's label pixels differ from the backplate, or that the pressed button's computedforced-color-adjustisnone. The Vue app likely has the same rule (this one was copied from it, per the commit message), but that app was not driven in this run.ttoggles it while the keys are on and is just a letter inside a fieldpnpm exec playwright test e2e/frame.spec.ts e2e/checkout.spec.ts --reporter=list(webServer:pnpm build && pnpm starton :4274, desktop + Pixel 7 projects): 35 passed, 1 skipped by design (t key on mobile)PORT=4275 pnpm start(productiontsx server/index.ts dist), driven bynode capture.mjs(Playwright Chromium): desktop dark/light form, client errors, placed order with the Shiki-highlighted order.json; the status line theme switch and its persistence after reload; the keys switch; 320/390 px dark/light in English and German with server-side field errors, measuring sideways overflow; the disabled 'Placing your order...' button under and away from the pointer vs the enabled hover; the highlight-*.js chunk aborted; forced colors on the language switch and the terms checkboxMutation check: undid.button:enabled:hover→.button:hover, the forced-colors Highlight selectors and.catch(() => undefined)in CodeBlock, ranvite build --outDir /tmp/rc-mutant-01M7B8, served it on :4274 and ranplaywright test --project=desktop -g "faint while it is sent|plain text when its highlighter|tells the pressed language": all 3 failed as expected; sources restored withgit checkoutnode forced-colors-probe.mjs: forced colors (light and dark palettes) at DPR 3, zoomed shots of the language switch, the system color values, and a control bare button with background Highlight / color HighlightTextnode forced-colors-fix-probe.mjs: the same forced-colors shots withforced-color-adjust: noneinjected at runtime on the pressed language button🔧 Fix applied.
✅ Re-checked - no issues remain.
pnpm build(react-checkout production build)PORT=4275 tsx server/index.ts dist(the app's own server, serving the build)node round2/capture.mjs: desktop light/dark form, errors and placed order; theme and keys switches remembered after reload; 320/390 px in both themes with German server errors and sideways-overflow checks; disabled button under the pointer vs away; highlighter file blockednode round2/forced-colors.mjs: forced colors on light and dark systems, each language pressed, terms box ticked, label pixel count, plus a runtime mutant without the pressed-buttonforced-color-adjust: noneplaywright test e2e/frame.spec.ts e2e/checkout.spec.ts(desktop and mobile projects, fresh production build)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.