Skip to content

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

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

chore: design system colour tokens, primitives & Storybook#6883
talissoncosta wants to merge 13 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 8: Add Storybook 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).
  • 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 10, 2026 8:50pm
flagsmith-frontend-staging Ready Ready Preview, Comment Mar 10, 2026 8:50pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Mar 10, 2026 8:50pm

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.31%. Comparing base (da9d82d) to head (e3ea39b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6883   +/-   ##
=======================================
  Coverage   98.31%   98.31%           
=======================================
  Files        1335     1335           
  Lines       49689    49689           
=======================================
  Hits        48851    48851           
  Misses        838      838           

☔ 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>.

talissoncosta and others added 9 commits March 10, 2026 14:47
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>
@github-actions github-actions bot added chore and removed chore labels Mar 10, 2026
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>
@cursor
Copy link

cursor bot commented Mar 10, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on April 10.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

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>
@github-actions github-actions bot added chore and removed chore labels Mar 10, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-6883 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-6883 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-6883 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6883 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-6883 Finished ✅ Results

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

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

passed  10 passed

Details

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

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

passed  10 passed

Details

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 6 seconds
commit  e3ea39b
info  🔄 Run: #15217 (attempt 1)

@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2026

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  55 seconds
commit  e3ea39b
info  🔄 Run: #15217 (attempt 1)

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