Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

[CLOV-CSS] Migrate bpk-component-skeleton to CSS custom properties - #4952

Merged
Vincent Liu (xiaogliu) merged 2 commits into
mainfrom
migrate/css-vars-skeleton-4830
Jul 26, 2026
Merged

Vincent Liu (xiaogliu) merged 2 commits into
mainfrom
migrate/css-vars-skeleton-4830

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4830

Summary

  • Replaces static SASS token values with var(--css-custom-prop, sass-fallback) pattern in BpkBaseSkeleton.module.scss, BpkSkeleton.module.scss, and BpkSkeleton.stories.module.scss
  • Migrated tokens: surface-highlight, surface-tint, canvas-contrast, surface-contrast, border-radius-sm, border-radius-xs
  • Tokens kept as plain SASS (no CSS var equivalent): $bpk-duration-base, $bpk-one-pixel-rem, $bpk-private-skeleton-shimmer-*
  • Adds themeAttributes.tsx exporting component-scoped skeleton theme attribute arrays
  • Adds themeAttributes-test.tsx with assertions for all exported arrays
  • Updates index.ts to export the new themeAttributes symbols

Test plan

  • CI passes (jest, lint, type check)
  • Storybook skeleton stories render correctly
  • BackgroundStyleDefault and BackgroundStyleOnContrast stories show correct colours

- Replace static SASS tokens with CSS var() wrappers in BpkBaseSkeleton.module.scss,
  BpkSkeleton.module.scss, and BpkSkeleton.stories.module.scss
- Migrate: surface-highlight, surface-tint, canvas-contrast, surface-contrast,
  border-radius-sm, border-radius-xs to CSS custom properties with SASS fallbacks
- Add themeAttributes.tsx for component-scoped skeleton theme keys
- Add themeAttributes-test.tsx with assertions for exported arrays
- Update index.ts to export themeAttributes symbols

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 22, 2026 08:49
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Copilot AI 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.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Migrates bpk-component-skeleton styling to use CSS custom properties with SASS fallbacks, and introduces exported theme attribute lists for theming integrations.

Changes:

  • Replaced several hard-coded SASS token usages in Skeleton SCSS with var(--token, sass-fallback) patterns.
  • Added themeAttributes.tsx (and tests) to export skeleton theme attribute arrays.
  • Updated package index.ts exports to expose the new theme attribute symbols.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/backpack-web/src/bpk-component-skeleton/src/themeAttributes.tsx Introduces exported theme attribute arrays and a deprecated default export.
packages/backpack-web/src/bpk-component-skeleton/src/themeAttributes-test.tsx Adds Jest coverage asserting the exported arrays’ values.
packages/backpack-web/src/bpk-component-skeleton/src/BpkSkeleton.stories.module.scss Updates story backgrounds to use CSS custom properties with SASS fallbacks.
packages/backpack-web/src/bpk-component-skeleton/src/BpkSkeleton.module.scss Migrates border radii + on-contrast background to CSS custom properties.
packages/backpack-web/src/bpk-component-skeleton/src/BpkBaseSkeleton.module.scss Migrates base background color to CSS custom properties with fallback.
packages/backpack-web/src/bpk-component-skeleton/index.ts Exports new theme attribute symbols via package entrypoint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +26
export const skeletonThemeAttributes: string[] = [];

/**
* Combined deduplicated array of all skeleton private theme attributes.
* Only exposes component-scoped (private) skeleton tokens — global semantic vars
* (surface, canvas colours) can be overridden at the theme level independently.
*/
export const allSkeletonThemeAttributes: string[] = [];

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.

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

Comment on lines +28 to +34
/**
* @deprecated Use allSkeletonThemeAttributes instead.
* Will be removed in the next major release.
*/
const themeAttributes: string[] = [];

export default themeAttributes;

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.

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

* limitations under the License.
*/

export const skeletonThemeAttributes: string[] = [];

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.

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

* Only exposes component-scoped (private) skeleton tokens — global semantic vars
* (surface, canvas colours) can be overridden at the theme level independently.
*/
export const allSkeletonThemeAttributes: string[] = [];

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.

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

* @deprecated Use allSkeletonThemeAttributes instead.
* Will be removed in the next major release.
*/
const themeAttributes: string[] = [];

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.

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@xiaogliu

Copy link
Copy Markdown
Contributor

Token value audit — verified every new CSS var introduced in this PR against token-sync/css/theme-backpack-light.css / theme-backpack-dark.css and the original SASS token source (base.default.scss):

CSS var Old SASS fallback Light value Dark value Match
--bpk-surface-highlight $bpk-surface-highlight-day #e0e4e9 #243346 ✅
--bpk-radius-sm $bpk-border-radius-sm 0.5rem (no dark override — rem/radius values are theme-agnostic) ✅
--bpk-radius-xs $bpk-border-radius-xs 0.25rem (no dark override — rem/radius values are theme-agnostic) ✅
--bpk-surface-tint $bpk-surface-tint-day rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.1) ✅
--bpk-canvas-contrast $bpk-canvas-contrast-day #eff3f8 #010913 ✅
--bpk-surface-contrast $bpk-surface-contrast-day #05203c #010913 ✅

All new/old values match — no visual regression risk from this migration.

@xiaogliu Vincent Liu (xiaogliu) 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.

LGTM

@xiaogliu
Vincent Liu (xiaogliu) merged commit f9de2ba into main Jul 26, 2026
15 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-skeleton-4830 branch July 26, 2026 16:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate bpk-component-skeleton to CSS custom properties

3 participants