Repository navigation
[GH-4834][bpk-component-card] Migrate to CSS custom properties - #4906
Conversation
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]>
|
Visit https://backpack.github.io/storybook-prs/4906 to see this build running in a browser. |
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]>
There was a problem hiding this comment.
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.scssto emitvar(--bpk-surface-*, <sass-fallback>). - Replaces hard-coded surface/background + line/border tokens in
BpkCardV2.module.scsswith CSS custom properties (with fallbacks). - Updates
BpkCardWrapper.module.scssradii 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.
|
Visit https://backpack.github.io/storybook-prs/4906 to see this build running in a browser. |
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]>
|
Visit https://backpack.github.io/storybook-prs/4906 to see this build running in a browser. |
| // 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 |
There was a problem hiding this comment.
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.
Summary
BpkCardV2.module.scssandBpkCardWrapper.module.scsswithvar(--css-var, sass-fallback)per the issue token mapping_surfaces.scssshared mixin to usevar()map values — surface modifier classes (.bpk-card-v2--surface-highlightetc.) now respond to CSS var theming;bpk-panelgets this too$bpk-box-shadow-lg,$bpk-duration-sm,$bpk-input-border) left as bare SASS tokens per specCloses #4834
Test plan
🤖 Generated with Claude Code