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

[GH-4834][bpk-component-card] Migrate to CSS custom properties - #4906

Merged
GC Zhu (gc-skyscanner) merged 3 commits into
mainfrom
gert-janvercauteren/4834-card-css-vars
Jul 17, 2026
Merged

GC Zhu (gc-skyscanner) merged 3 commits into
mainfrom
gert-janvercauteren/4834-card-css-vars

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Summary

  • Replaces bare SASS tokens in BpkCardV2.module.scss and BpkCardWrapper.module.scss with var(--css-var, sass-fallback) per the issue token mapping
  • Fixes _surfaces.scss shared mixin to use var() map values — surface modifier classes (.bpk-card-v2--surface-highlight etc.) now respond to CSS var theming; bpk-panel gets this too
  • Gap tokens ($bpk-box-shadow-lg, $bpk-duration-sm, $bpk-input-border) left as bare SASS tokens per spec

Closes #4834

Test plan

  • All existing tests pass (363 tests across card, panel, layout)
  • No new CSS custom property names invented
  • Gap tokens left unchanged

🤖 Generated with Claude Code

Replaces bare SASS tokens in BpkCardV2 and BpkCardWrapper with
var(--css-var, sass-fallback) so colours respond to dark mode.

Also fixes the shared bpk-surface-bg-colors mixin in _surfaces.scss to
use var() map values, matching the BpkText pattern — so all surface
modifier classes (.bpk-card-v2--surface-highlight etc.) now respond to
CSS var theming. bpk-panel uses the same mixin and gets this for free.

Gap tokens left as bare SASS ($bpk-box-shadow-lg, $bpk-duration-sm,
$bpk-input-border, $bpk-one-pixel-rem) per issue spec.

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

Copy link
Copy Markdown
Contributor

Adds tags: ['dark-mode-compatible'] to the meta object in BpkButton,
BpkCard, and BpkCardV2 story files so all stories in those files are
flagged for dark mode testing in Storybook.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@gert-janvercauteren Gert-Jan Vercauteren (gert-janvercauteren) changed the title [CLOV-4834][bpk-component-card] Migrate to CSS custom properties [GH-4834][bpk-component-card] Migrate to CSS custom properties Jul 17, 2026

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-card surface/background styling from fixed SASS tokens to CSS custom properties (with SASS fallbacks) so cards/panels can respond to runtime theming via var().

Changes:

  • Updates surface background color map in _surfaces.scss to emit var(--bpk-surface-*, <sass-fallback>).
  • Replaces hard-coded surface/background + line/border tokens in BpkCardV2.module.scss with CSS custom properties (with fallbacks).
  • Updates BpkCardWrapper.module.scss radii to use CSS custom properties (with fallbacks).

Reviewed changes

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

File Description
packages/backpack-web/src/bpk-mixins/_surfaces.scss Surface map values now output CSS custom properties so generated modifier classes can be themed at runtime.
packages/backpack-web/src/bpk-component-card/src/BpkCardWrapper.module.scss Card wrapper radii now use CSS vars with SASS fallbacks.
packages/backpack-web/src/bpk-component-card/src/BpkCardV2/BpkCardV2.module.scss Card V2 background, border, and divider line/border sizes now use CSS vars with SASS fallbacks.

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

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

bpk-border-radius-{xs,sm,md,lg,xl} now emit var(--bpk-radius-*, sass-fallback)
so any component using these mixins (including BpkCardV2) picks up
corner-radius theming automatically.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor
Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 1e01769

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

// Outlined variant - replaces shadow with border
.bpk-card-v2--outlined {
border: tokens.$bpk-border-size-sm solid tokens.$bpk-line-day;
border: var(--bpk-border-1, tokens.$bpk-border-size-sm) solid

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The border changed from px -> rem.
In the visual test sample the border will then adjust from 1px, to 2px.
This is an intended change.

@gc-skyscanner
GC Zhu (gc-skyscanner) merged commit 13b10b2 into main Jul 17, 2026
15 checks passed
@gc-skyscanner
GC Zhu (gc-skyscanner) deleted the gert-janvercauteren/4834-card-css-vars branch July 17, 2026 06:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate bpk-component-card to CSS custom properties

3 participants