Skip to content

Replace palette JS imports with CSS variables in Admin UI#7954

Merged
gilluminate merged 4 commits intomainfrom
gill/replace-palette-imports-with-css-vars
Apr 17, 2026
Merged

Replace palette JS imports with CSS variables in Admin UI#7954
gilluminate merged 4 commits intomainfrom
gill/replace-palette-imports-with-css-vars

Conversation

@gilluminate
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate commented Apr 17, 2026

First step of ENG-3410

Description Of Changes

The fidesui palette is exposed two ways: as a JS import (palette.FIDESUI_*) and as CSS variables (var(--fidesui-*)), both generated from the same SCSS source map. This PR replaces all 40 JS palette imports across admin-ui and privacy-center with their CSS variable equivalents.

This reduces build-time SCSS module resolution dependencies in TS files and aligns with the CSS-first direction the codebase is heading with Ant Design tokens.

The :export block in palette.module.scss is still needed for fidesui internals (theme config, CustomTag, Storybook) but no longer has any consumers outside of fidesui/.

Code Changes

  • Removed import palette from "fidesui/src/palette/palette.module.scss" from 40 files (39 admin-ui + 1 privacy-center)
  • Replaced ~114 palette.FIDESUI_* references with "var(--fidesui-*)" CSS variable strings
  • Fixed a latent bug in TaxonomyTreeEdge.tsx where palette.NEUTRAL_400 (missing FIDESUI_ prefix) was likely resolving to undefined

Steps to Confirm

  1. Run npx tsc --noEmit in both clients/admin-ui and clients/privacy-center -- should pass with no errors
  2. Verify no palette imports remain: grep -r 'from "fidesui/src/palette' clients/admin-ui/src/ clients/privacy-center/
  3. Visual spot-check: navigation sidebar, home page cards, taxonomy tree, datamap graph edges, status indicator icons, messaging form verified checkmarks

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

gilluminate and others added 2 commits April 17, 2026 09:04
…vacy-center

The fidesui palette is available both as a JS import (palette.FIDESUI_*)
and as CSS variables (var(--fidesui-*)). This replaces all 40 JS imports
with CSS variable equivalents, reducing build-time SCSS module resolution
dependencies and aligning with the CSS-first direction of the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 17, 2026

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

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Apr 17, 2026 4:28pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Apr 17, 2026 4:28pm

Request Review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Title Lines Statements Branches Functions
admin-ui Coverage: 8%
6.17% (2709/43840) 5.38% (1340/24884) 4.24% (550/12962)
fides-js Coverage: 78%
78.98% (1962/2484) 65.55% (1214/1852) 72.57% (336/463)
privacy-center Coverage: 88%
85.97% (331/385) 81.36% (179/220) 78.87% (56/71)

@gilluminate gilluminate marked this pull request as ready for review April 17, 2026 15:50
@gilluminate gilluminate requested a review from a team as a code owner April 17, 2026 15:50
@gilluminate gilluminate requested review from lucanovera and removed request for a team April 17, 2026 15:50
Copy link
Copy Markdown
Contributor

@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

This is a well-scoped, mechanical refactor that removes 40 import palette from "fidesui/src/palette/palette.module.scss" calls across admin-ui and privacy-center and replaces ~114 palette.FIDESUI_* references with their "var(--fidesui-*)" CSS variable equivalents. The changes are consistent and correctly follow the FIDESUI_FOO_BAR--fidesui-foo-bar naming convention throughout.

Highlights

Bug fix bonus: TaxonomyTreeEdge.tsx had palette.NEUTRAL_400 (missing the FIDESUI_ prefix), which silently resolved to undefined at runtime. This is fixed as a side effect of the migration — a nice catch.

Approach is sound: Using CSS variables aligns with the Ant Design token direction and decouples TypeScript build artifacts from SCSS module resolution. The palette.module.scss :export block still has internal consumers in fidesui/, so no premature removal there.

Findings

Type safety trade-off (non-blocking): The palette object gave TypeScript a compile-time guarantee that the color key existed. CSS variable strings are opaque — a typo like var(--fidesui-sucess) silently renders with no color. This is acceptable for now, but if the pattern grows it may be worth a thin typed helper or a const map. Inline comment left on AuthorizationStatus.tsx as a representative example.

ExternalTaskLayout.tsx CSS variable scope (verify during spot-check): The privacy-center's external tasks layout uses backgroundColor: "var(--fidesui-neutral-75)" in an inline style. Confirm that the fidesui CSS variable definitions are in scope for this page's bundle. If the page can be served with a reduced stylesheet, the fallback would be transparent/white rather than the neutral grey. Not a regression from this PR, but worth including in the visual spot-check.

Summary

No blockers. The migration is correct, complete (no remaining palette imports outside fidesui/), and the bug fix is a welcome bonus. The inline comments are advisory / for future consideration.

🔬 Codegraph: unavailable


💡 Write /code-review in a comment to re-run this review.

@gilluminate gilluminate changed the title Replace palette JS imports with CSS variables Replace palette JS imports with CSS variables in Admin UI Apr 17, 2026
Copy link
Copy Markdown
Contributor

@lucanovera lucanovera left a comment

Choose a reason for hiding this comment

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

Thanks for removing the awkward JS imports for the palette. Found no visual regressions. Approved!

@gilluminate gilluminate added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit 625995b Apr 17, 2026
50 of 51 checks passed
@gilluminate gilluminate deleted the gill/replace-palette-imports-with-css-vars branch April 17, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants