Components: migrate Surface to SCSS module#79445
Conversation
|
Flaky tests detected in 31227de. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/28092506671
|
2f1386a to
43cbacb
Compare
|
Size Change: +255 B (0%) Total Size: 7.51 MB 📦 View Changed
|
| case 'tertiary': { | ||
| return tertiary; | ||
| } |
There was a problem hiding this comment.
The tertiary variants wasn't actually producing any visually different style, the refactor simply ignores it
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| surfaceBackgroundColor: COLORS.white, | ||
| surfaceBackgroundSubtleColor: '#F3F3F3', | ||
| surfaceBackgroundTintColor: '#F5F5F5', | ||
| surfaceBorderColor: 'rgba(0, 0, 0, 0.1)', | ||
| surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)', | ||
| surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)', | ||
| surfaceBackgroundTertiaryColor: COLORS.white, |
There was a problem hiding this comment.
I know! Working on this migration feels like an alternative kind of therapy 🤣
| position: relative; | ||
| } | ||
|
|
||
| .borderBottom { |
There was a problem hiding this comment.
These class names should all be kebab case.
Looks like the selector-class-pattern stylelint rule would enforce this, but it is disabled for the repo 🤔 Maybe we can enable it in the components-related packages?
gutenberg/packages/stylelint-config/index.js
Lines 58 to 63 in c5cdf2a
c88a8f9 to
d1c9495
Compare
Part of #66806.
What?
Migrates
Surfaceaway from Emotion styles and onto an SCSS Module.Why?
This is one of the canary components for the refreshed Emotion migration plan. It validates the SCSS Modules path while preserving the public
components-surfaceclass name.How?
styles.tsfile withstyle.module.scss.clsxfor variant and border classes, without adding public data attributes.Surfaceexposes physical border props.backgroundSizedynamic through scoped CSS custom properties.assupport through the underlyingViewcomponent; migratingViewitself remains separate.Hardcoded/shared values moved to WPDS tokens
#fff/ Surface background values--wpds-color-background-surface-neutral-strong#1e1e1e/COLORS.gray[ 900 ]--wpds-color-foreground-content-neutral#f5f5f5/ secondary background--wpds-color-background-surface-neutral-weakrgba(0, 0, 0, 0.1)/ border and dotted backing color--wpds-color-stroke-surface-neutralrgba(0, 0, 0, 0.05)/ grid line color--wpds-color-stroke-surface-neutral-weak1px/ border and grid stroke width--wpds-border-width-xsTesting Instructions
npm run test:unit packages/components/src/surface/test/index.tsx -- --runInBandnpm run lint:js -- packages/components/src/surfacenpm run lint:css -- packages/components/src/surface/style.module.scssnpx tsgo --build packages/components/tsconfig.jsongit diff --checkTesting Instructions for Keyboard
No keyboard-specific behavior changed.
Surfaceis a non-interactive primitive.Screenshots or screencast
Not applicable; this should preserve the existing visual output.
Use of AI Tools
Used AI assistance to inspect the existing component implementation, apply the migration, and draft this PR description. The changes were reviewed and verified locally.