Skip to content

chore: design system colour tokens, primitives & Storybook#6883

Open
talissoncosta wants to merge 16 commits intomainfrom
chore/design-system-tokens
Open

chore: design system colour tokens, primitives & Storybook#6883
talissoncosta wants to merge 16 commits intomainfrom
chore/design-system-tokens

Conversation

@talissoncosta
Copy link
Contributor

@talissoncosta talissoncosta commented Mar 9, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #6606

Establishes the foundational colour architecture for the design system:

  • Primitive palette: Add _primitives.scss with full 50–950 tonal scales (Tailwind convention) for all 7 colour families. Existing hex anchors are locked — zero visual change to shipped UI.
  • Semantic tokens: Add _tokens.scss with CSS custom properties organised by role (brand, surface, text, border, feedback) with light/dark mode variants. Wire into styles.scss.
  • Alpha colour fix: Align _variables.scss alpha values with correct primitive RGB bases.
  • Storybook 10: Add Storybook 10.3 with webpack5, SCSS support, dark mode toggle, a11y addon, and Flagsmith branding. Dynamic stories for Colour Palette (auto-parsed from _primitives.scss) and Semantic Tokens (auto-discovered from CSS custom properties).
  • Documentation folder: Stories and docs live in a self-contained documentation/ directory, separate from application code — easy to remove or extract into a dedicated design system repo later.
  • Chromatic CI: GitHub Actions workflow for visual regression on PRs (requires CHROMATIC_PROJECT_TOKEN secret).

How did you test this code?

  • npm run build-storybook builds without errors
  • Storybook Colour Palette story shows smooth 50–950 scales for all 7 families
  • Storybook Semantic Tokens story renders live preview with light/dark toggle
  • ENV=local npm run dev — app builds and renders identically (no visual regression)
  • Chromatic CI requires CHROMATIC_PROJECT_TOKEN secret to be added to the repo

@vercel
Copy link

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Mar 24, 2026 4:07pm
flagsmith-frontend-staging Ready Ready Preview, Comment Mar 24, 2026 4:07pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Mar 24, 2026 4:07pm

Request Review

@github-actions github-actions bot added the front-end Issue related to the React Front End Dashboard label Mar 9, 2026
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.32%. Comparing base (94780fe) to head (03d3462).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6883   +/-   ##
=======================================
  Coverage   98.32%   98.32%           
=======================================
  Files        1335     1337    +2     
  Lines       49850    49910   +60     
=======================================
+ Hits        49013    49073   +60     
  Misses        837      837           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@talissoncosta
Copy link
Contributor Author

Blocker: #6866 (Decouple Button from Redux store) should land before or alongside this PR — Button's dependency on AccountStore and Redux state prevents adding Storybook stories for any component that uses <Button>.

@github-actions github-actions bot added the chore label Mar 9, 2026
@talissoncosta talissoncosta linked an issue Mar 10, 2026 that may be closed by this pull request
7 tasks
@talissoncosta talissoncosta force-pushed the chore/design-system-tokens branch from 42b4c1e to 87a4eae Compare March 10, 2026 20:10
@github-actions github-actions bot added chore and removed chore labels Mar 10, 2026
@github-actions github-actions bot added chore and removed chore labels Mar 10, 2026
@github-actions github-actions bot added chore and removed chore labels Mar 10, 2026
@talissoncosta talissoncosta marked this pull request as ready for review March 10, 2026 20:47
@talissoncosta talissoncosta requested review from a team as code owners March 10, 2026 20:47
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@github-actions github-actions bot added chore and removed chore labels Mar 23, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  25.3 seconds
commit  e3ea39b
info  🔄 Run: #15428 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  47.6 seconds
commit  e3ea39b
info  🔄 Run: #15428 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  51.5 seconds
commit  e3ea39b
info  🔄 Run: #15428 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 1 second
commit  e3ea39b
info  🔄 Run: #15428 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  19.8 seconds
commit  68f514c
info  🔄 Run: #15438 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  23.5 seconds
commit  68f514c
info  🔄 Run: #15438 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  16 passed

Details

stats  16 tests across 13 suites
duration  33.6 seconds
commit  68f514c
info  🔄 Run: #15438 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  53 seconds
commit  68f514c
info  🔄 Run: #15438 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  46.5 seconds
commit  03d3462
info  🔄 Run: #15461 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  7.2 seconds
commit  03d3462
info  🔄 Run: #15461 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  45.6 seconds
commit  03d3462
info  🔄 Run: #15461 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 9 seconds
commit  03d3462
info  🔄 Run: #15461 (attempt 1)

talissoncosta and others added 13 commits March 24, 2026 08:28
Introduce a structured colour system with primitive SCSS scales
(_primitives.scss) and semantic CSS custom properties (_tokens.scss)
with light/dark mode support. Align existing _variables.scss colour
values to the new primitives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configure Storybook 8 with webpack5, SWC, SCSS support, and dark mode
toggle. Add ColourPalette and SemanticTokens stories to visualise the
design system. Include eslint-plugin-storybook and gitignore entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run Chromatic on PRs that touch frontend files to catch visual
regressions automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce Storybook as the frontend development hub with getting
started instructions, story writing guidelines, and project structure
overview.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run Storybook automigrations and manually convert main.js to ESM
(.mjs). Remove @storybook/blocks (consolidated into addon-docs),
replace @storybook/addon-essentials with core equivalents, and update
all Storybook packages to v10.2.17.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add manager.js with custom theme using our primitive palette colours,
Flagsmith logo, and dark sidebar. Add manager-head.html to constrain
logo size. Configure staticDirs to serve assets from web/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend semantic token layer with surface-hover, surface-active, and
hover/active states for danger, success, and warning feedback colours.
Dark mode inverts to lighter steps. These are generic role-based
tokens — no component-specific tokens needed.

Refs #6904

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrite SemanticTokens story to read --color-* CSS custom properties
from the DOM at render time instead of hardcoding values. Tokens are
auto-discovered, grouped by prefix, and computed values update when
toggling themes.

Rewrite ColourPalette story to parse _primitives.scss via raw-loader
at build time. Adding a new SCSS variable automatically adds a swatch.

No more manual story updates when tokens or primitives change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix <code> elements inheriting Storybook/Bootstrap colour overrides
that made them invisible in light mode. Fix colour palette swatches
wrapping to a second row by using flex layout instead of fixed widths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Storybook 10 requires TypeScript >= 4.9 but the project uses 4.6.4.
Add --legacy-peer-deps to npm ci to unblock CI until TypeScript is
upgraded in a separate effort.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Revert the Storybook 8→10 upgrade and the --legacy-peer-deps CI
workaround. SB10 requires TypeScript >= 4.9 but the project uses
4.6.4, causing 805 type errors on upgrade. Staying on SB8 avoids
masking dependency issues with --legacy-peer-deps.

The SB10 upgrade can be revisited alongside TypeScript 5.x (#6919).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move repeated inline CSS from story files into stories/docs.scss and
reusable components (DocPage, ScaleRow, TokenGroup) under
stories/components/. Keeps stories focused on data logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove --legacy-peer-deps (unnecessary with SB8), enable draft PR gate,
pin chromaui/action to v11. Add clarifying comment on no-deps useEffect
in SemanticTokens story.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
talissoncosta and others added 3 commits March 24, 2026 13:01
- storybook: 8.6.18 → 10.3.3
- @storybook/react-webpack5: 8.6.18 → 10.3.3
- @storybook/addon-a11y: 8.6.18 → 10.3.3
- @storybook/addon-webpack5-compiler-swc: 1.0.6 → 4.0.2
- @storybook/addon-docs: added (MDX support, unbundled from essentials)
- eslint-plugin-storybook: 0.12.0 → 10.3.3
- Removed @storybook/addon-essentials and @storybook/blocks (absorbed into core)

The TS version blocker (4.6.4) has been resolved — TS is now 5.9.3.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- @storybook/manager-api → storybook/manager-api
- @storybook/theming → storybook/theming
- @storybook/react-webpack5 (types) → storybook
- @storybook/blocks → @storybook/addon-docs/blocks
- Remove addon-essentials from addons, add addon-docs explicitly
- Silence Dart Sass slash-div deprecation in sass-loader

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Self-contained documentation folder, separate from application code.
Easier to remove or extract into a dedicated design system repo later.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce semantic colour tokens and primitive palette

1 participant