Repository navigation
refactor(atoms): replace theme props with inherited surface tokens - #188
Merged
Merged
Conversation
…prop `focusRing(theme)` returned a class string per theme, so every component that sat on a dark surface had to be told so, and `Logo` grew a `theme` prop it used for nothing else. The ring now lives in `layouts/tailwind.css` as `@utility focus-ring`, reading two inherited custom properties. `:root` is light, and a container that paints a dark surface sets `surface-dark` once. - `Link` and `Button` claim a surface only when given a `theme`, so an unthemed atom inherits its container's instead of overriding it. - `Header`, `Splash`, `OrnateTextBox` and Ladle's dark `StorySection` set their surface. `Logo` loses its `theme` prop, and `Button` no longer threads `theme` into its inner `Link`. - `SocialIcon` and the `Splash` call to action adopt `focus-ring`. `SocialIcon`'s `teal-500` ring measured 2.70:1. - `layouts/tailwind.test.ts` compiles the real stylesheet and fails if a ring drops under 3:1 against its offset band. Follows #134. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying wemeditate-design with
|
| Latest commit: |
e9b826f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://710c93fe.wm-design.pages.dev |
| Branch Preview URL: | https://claude-refactor-focus-ring-u.wm-design.pages.dev |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | e9b826f | Commit Preview URL Branch Preview URL |
Oct 13 2026, 03:20 PM |
The focus ring was the first colour to move into the surface. This moves the rest. `surface-light` and `surface-dark` now set thirteen tokens, and `@theme inline` exposes them as colours (`text-fg`, `text-fg-muted`, `text-primary`, `text-secondary`, `border-line`, `bg-tint`, ...), so a component resolves them against whatever surface it sits on. - `Link`, `Button`, `Icon`, `Spinner`, `Breadcrumbs`, `Countdown`, `Header` and `HeaderNavDropdown` lose their `theme` prop, and their paired light/dark colour maps become one map. - `Splash`, `ContentOverlay` and Ladle's `StorySection` keep a prop, renamed `surface`: only SahajCloud's `textColor` knows whether their image is dark. `lib/content-blocks.ts` inverts it once (`textColorToSurface`), and `LayoutChrome` sets the lead splash's surface on the header wrapper. - Two drifts resolved: neutral is white on every dark surface (`Link` was `gray-300`), and secondary is `coral-600` on light (`Icon` and `Spinner` were `coral-500`, 2.53:1). Dark text buttons no longer swap their primary/secondary hover fill. - `Button`'s spinner takes `border-current`, replacing two helpers that guessed a spinner colour per variant and theme. - `layouts/tailwind.test.ts` now also fails if a token resolves at `:root` (dropping `inline`) or if one surface omits a token. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
pushed a commit
that referenced
this pull request
Oct 13, 2026
#188 landed the surface-token refactor, which rewrote the one line this branch also changed: `Splash`'s `<h1>`. Both sides are kept. This branch replaced the dead `font-raleway` with `font-sans`; `main` replaced the `${textColor}` prop with the `text-fg` surface token and deleted the prop, so taking either side alone would drop a fix or leave an undefined variable. The className is now a plain string, since nothing is interpolated into it any more. Every other file auto-merged. `@theme inline`, which #188 adds for the surface tokens, needs no change to the new utility guard: it declares no token on a numeric scale, and the guard already reads the whole stylesheet rather than one `@theme` block. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01D5B9zSNF2QsmUZVE9oT5Wx
sydevs-bot
pushed a commit
that referenced
this pull request
Oct 13, 2026
main's surface-token refactor (#188) and this branch's touch-target work both rewrote `Button.test.tsx` and the custom-utility section of `docs/rules/tailwind.md`. - `Button.test.tsx`: both icon imports are kept, since both sides' cases need one. `focusClasses` goes with the per-variant ring tests main deleted — it had no other caller once `focus-ring` replaced the per-variant axis. - `docs/rules/tailwind.md`: one utility list covering both sides — `focus-ring` and the `surface-*` pair from main, the touch-target pair from here. The emission-order ⚠ and main's closing rule both stay. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_013W5aYCeine4RigrTLH6nYj
This was referenced Oct 13, 2026
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.
Summary
thememeant "what surface am I on" in all 11 components that took it, and each component kept its own light and dark colour maps. Those maps had drifted apart. Colours now come from the surface instead.surface-light(also:root) andsurface-darkeach set 13 tokens, and@theme inlineexposes them as ordinary Tailwind colours:text-fg,text-fg-muted,text-primary,text-secondary,border-line,bg-tint,focus-ring, and so on. A component uses those classes and gets whichever surface it sits on. The nearest surface ancestor wins.themeprop at all.Link,Button,Icon,Spinner,Breadcrumbs,Countdown,Header,HeaderNavDropdownandLogolose it.OrnateTextBoxis always dark, and the sticky nav turns light once it sticks.Splash,ContentOverlayand Ladle'sStorySectionkeep a prop, renamedsurface, because only SahajCloud'stextColorknows whether their image is dark.This started as the follow-up #134 deferred: moving the focus ring into a CSS
@utility. The ring is the first token. The second commit moves the rest of the colours.Changes
layouts/tailwind.css: the two surface utilities, the:rootdefault, the@theme inlinecolour aliases, and@utility focus-ring.components/atoms/surface.tsreplacesfocusRing.ts. It exports aSurfacetype andsurface(), used only by the components that paint one.Link,Icon,Spinner: each pair of light/dark colour maps becomes one map of tokens.Spinner'scolornow applies to the logo variant too.Button: filled variants are the same on every surface, and outline and ghost use tokens. Its four maps become two. Its spinner draws inborder-current, which replaces thegetSpinnerColorandgetSpinnerThemehelpers.Breadcrumbs,Countdown,Header: text and borders use tokens.Headerno longer passestheme={isSticky ? 'light' : theme}to every child. The nav setssurface-lightonce it sticks.LayoutChromeputs the lead splash's surface on the header wrapper.lib/content-blocks.tsrenamestextColorToThemetotextColorToSurfaceandsplashThemetosplashSurface, and{ theme }becomes{ surface }.SocialIconand theSplashcall to action adoptfocus-ring.SocialIcon's oldteal-500ring measured 2.70:1.theme. Dark wrappers getsurface-dark(StorySection surface="dark", and the ad-hocbg-gray-900andbg-teal-600boxes). Two dark-splashHeaderoverlays in theSplashstory never passedtheme; they now render white.DESIGN_SYSTEM.md, and a Surfaces section indocs/rules/design-system.md.STORYBOOK.md,docs/rules/tailwind.mdand the atoms README are updated.Visual changes, deliberate
Link neutralwasgray-300.Icon,Spinner,ButtonandHeaderwere already white.coral-600everywhere.IconandSpinnerusedcoral-500(2.53:1). Neutral icons and spinners on light move fromgray-600togray-700.500to600on every surface. It used to be600to500on dark.gray-700instead ofteal-600.border-line. On light that isgray-500instead ofgray-400. It is decorative andaria-hidden.Test results
tsc --noEmit,vitest run(87 files, 867 tests).pnpm build✓. The built CSS contains every token utility, both surfaces, and the:rootdefaults.layouts/tailwind.test.tscompiles the real stylesheet and checks four things:@theme inlinelosesinline; mutation-checked.focus-ringwrites abox-shadowonly on:focus-visible.teal-500.LinkandButtoncolour outline and ghost from tokens only, and never set a surface. They also check that the stickyHeadernav setssurface-light.Button,Link,SpinnerandHeaderstories in headless Chrome against a local Ladle. Dark sections draw white outline and ghost buttons,teal-300/coral-300/white links, and a white header withteal-300breadcrumbs. Light sections are unchanged apart from the shifts listed above.Manual verification
The screenshots don't cover keyboard focus or hover:
ButtonandLink. You should see a white ring over ateal-900band.gray-800text) and the ghost buttons (expect a 20% white tint).OrnateTextBoxand a darkContentOverlayCTA on desktop. On mobile, the stackedContentOverlayshould stay light.Notes for reviewer
dark:-style custom variant. A descendant selector like "inside.surface-dark" still matches a light panel nested in a dark one. Inherited custom properties always pick the nearest surface.Buttonusesborder-currentfor its spinner instead of declaring itself dark.surface-lighttoken each, rather than editing every component.EmbedButton's textarea andAlert's dismiss button. Fields show focus on their border, so changing them is a design call./simplify,/pr-review-toolkit:review-prand/security-reviewwere not run. No path here matches the security trigger pattern.Follows #134.
🤖 Generated with Claude Code