Skip to content

feat: Elevation tokens scale for core and percipio themes - #3410

Open
LinKCoding wants to merge 16 commits into
mainfrom
kl-gmt-1704-gamut-elevation-tokens
Open

feat: Elevation tokens scale for core and percipio themes#3410
LinKCoding wants to merge 16 commits into
mainfrom
kl-gmt-1704-gamut-elevation-tokens

Conversation

@LinKCoding

@LinKCoding LinKCoding commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds a themeable elevation scale to the Gamut themes so surfaces like Card get their hover shadow and lift from the active theme instead of hardcoded Core values.

  • Adds packages/gamut-styles/src/variables/elevation.ts with coreElevation and percipioElevation scale factories, plus exported ElevationScale / ElevationState / ElevationStateStyles / ElevationScaleFactory types. Factories receive the theme's colors via .addScale('elevation', ...), so colors['shadow-primary'] resolves per theme and color mode without circular theme imports.
  • Registers the scale on coreTheme and percipioTheme; each scale defines rest, hover, and hoverMirrored states with shadow and transform tokens (flattened to dashcase keys like elevation['hover-shadow']). The shared return type guarantees every theme emits the same tokens.
  • Percipio's scale uses a soft blurred shadow with no hover lift; Core keeps the hard offset shadow with a translate lift.
  • Replaces Card's hoverShadowLeft/hoverShadowRight style factories with a useCardElevation hook that reads the elevation tokens from useTheme(), regrouped into framer-motion variants via a getElevationStyles helper. Outline shadow variants keep their bespoke two-layer shadow but share the scale's transforms.
  • Documents the scale in the styleguide: new Elevation sections in CoreTheme.mdx and PercipioTheme.mdx, backed by a shared createElevationTable that renders one row per state with paths, values, and a live shadow/lift example (dashed outline marks the resting position).

PR Checklist

Testing Instructions

  1. Go to Foundations → Theme → Core Theme — confirm the new Elevation section renders rest, hover, and hoverMirrored rows with shadow/transform paths, values, and example boxes (dashed outline should hug the box with no gap at the bottom).
  2. Open Foundations → Theme → Percipio Theme and confirm its Elevation section shows the soft blurred shadows with transform: none on every state.
  3. Go to the Card story with isInteractive and hover it — the shadow and lift should match the previous behavior (patternLeft/default lifts up-right with a left shadow, patternRight mirrors it, outline keeps its two-layer outline shadow).
  4. Toggle color mode and see that the Card's shadow reflect the changes (note that some Cards have static colors)
  5. Change the theme to Percipio and see that the shadows reflect accurately
  6. Toggle color mode again to see the changes in light/dark mode
  7. ...
  8. Profit

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

@nx-cloud

nx-cloud Bot commented Aug 12, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit f27e4dd


☁️ Nx Cloud last updated this comment at 2026-08-20 16:07:53 UTC

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@LinKCoding
LinKCoding force-pushed the kl-gmt-1704-gamut-elevation-tokens branch from e4f4c07 to e9d9aa3 Compare August 18, 2026 14:25
@LinKCoding LinKCoding changed the title Kl gmt 1704 gamut elevation tokens feat: Elevation tokens scale for core and percipio themes Aug 19, 2026
@LinKCoding
LinKCoding marked this pull request as ready for review August 19, 2026 14:50
@LinKCoding
LinKCoding requested a review from a team as a code owner August 19, 2026 14:50

@dreamwasp dreamwasp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great!

@codecademydev

Copy link
Copy Markdown
Collaborator

📬 Published Alpha Packages:

Package Version npm Diff
@codecademy/gamut 73.0.1-alpha.909ba2.0 npm diff
@codecademy/gamut-icons 10.0.1-alpha.909ba2.0 npm diff
@codecademy/gamut-illustrations 1.0.1-alpha.909ba2.0 npm diff
@codecademy/gamut-kit 3.0.18-alpha.909ba2.0 npm diff
@codecademy/gamut-patterns 1.0.1-alpha.909ba2.0 npm diff
@codecademy/gamut-styles 21.0.1-alpha.909ba2.0 npm diff
@codecademy/gamut-tests 7.0.1-alpha.909ba2.0 npm diff
@codecademy/variance 1.0.1-alpha.909ba2.0 npm diff
eslint-plugin-gamut 3.0.1-alpha.909ba2.0 npm diff

@github-actions

Copy link
Copy Markdown
Contributor

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.

3 participants