Repository navigation
[CLOV-CSS] Migrate bpk-component-dialog to CSS custom properties - #4932
Conversation
|
Visit https://backpack.github.io/storybook-prs/4932 to see this build running in a browser. |
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-dialog styling toward CSS custom properties (with SASS fallbacks) and adds a Storybook example to validate dark mode rendering.
Changes:
- Replaced several static SASS token usages with
var(--token, fallback)in dialog icon styles. - Added “gap” annotations for tokens without CSS custom property equivalents and migrated one surface color to a CSS var.
- Introduced a
DarkModeStorybook story viaBpkDarkExampleWrapper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-dialog/src/BpkDialogInner.module.scss | Adds “gap” annotations and migrates a surface background to a CSS custom property with fallback. |
| packages/backpack-web/src/bpk-component-dialog/src/BpkDialog.stories.js | Adds a dark mode Storybook story wrapped in BpkDarkExampleWrapper. |
| packages/backpack-web/src/bpk-component-dialog/src/BpkDialog.module.scss | Migrates icon border/background/fill styling to CSS custom properties with SASS fallbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| transition: | ||
| opacity tokens.$bpk-duration-sm ease-in-out, | ||
| transform tokens.$bpk-duration-sm ease-in-out; | ||
| /* gap: animation duration */ transform tokens.$bpk-duration-sm ease-in-out; /* gap: animation duration */ |
There was a problem hiding this comment.
Resolved — this comment referred to the /* gap: */ inline comments, which have since been removed entirely in a later commit ("Remove gap comments from SCSS"). No action needed.
| outline: 0; | ||
| background-color: tokens.$bpk-modal-background-color; | ||
| opacity: tokens.$bpk-modal-opacity; | ||
| background-color: tokens.$bpk-modal-background-color; /* gap: backdrop colour */ |
There was a problem hiding this comment.
Resolved — this comment referred to the /* gap: */ inline comments, which have since been removed entirely in a later commit ("Remove gap comments from SCSS"). No action needed.
|
|
||
| > svg { | ||
| fill: tokens.$bpk-text-primary-inverse-day; | ||
| fill: var(--bpk-text-inverse, #{tokens.$bpk-text-primary-inverse-day}); |
There was a problem hiding this comment.
Verified against the theme CSS files — --bpk-text-inverse is the correct, existing CSS var (confirmed present in both theme-backpack-light.css and theme-backpack-dark.css) and is the intended mapping for $bpk-text-primary-inverse-day per the CSS-vars migration convention. The naming difference is expected: CSS var names were redesigned to be shorter/semantic rather than 1:1 renames of the SASS token names. No change needed here.
| border: calc(#{tokens.$bpk-border-size-lg} * 2) | ||
| var(--bpk-surface-default, #{tokens.$bpk-surface-default-day}) solid; |
There was a problem hiding this comment.
Fixed in 3ccb23f — reverted to compile-time SASS multiplication (tokens.$bpk-border-size-lg * 2) and kept var() only on the color, matching the original pattern.
Replaces static SASS tokens with CSS var() calls for theme-able colour properties in BpkDialog and BpkDialogInner. Gap tokens (z-index, animation duration/opacity, backdrop colour, content padding, max-width) are kept as bare SASS tokens with gap comments pending CSS var availability. Adds a DarkMode story using BpkDarkExampleWrapper. Closes #4836 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
99c667a to
b3cde76
Compare
|
Visit https://backpack.github.io/storybook-prs/4932 to see this build running in a browser. |
Vincent Liu (xiaogliu)
left a comment
There was a problem hiding this comment.
Reviewed ✅ — no issues found.
- All six new vars (
--bpk-core-accent,--bpk-status-warning-spot,--bpk-status-danger-spot,--bpk-text-inverse,--bpk-surface-default,--bpk-surface-contrast) are confirmed to exist in the theme CSS files, with values matching their original SASS tokens exactly. - Icon background colours (primary/warning/destructive) are paired correctly with the corresponding svg fill (
text-inverse) — no missed sibling updates.
Verified new token values against token-sync/css/theme-backpack-light.css / theme-backpack-dark.css / primitives.css.
|
Visit https://backpack.github.io/storybook-prs/4932 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4932 to see this build running in a browser. |
Leftover from removing the /* gap: */ comments — was failing the declaration-empty-line-before lint rule in CI.
|
Visit https://backpack.github.io/storybook-prs/4932 to see this build running in a browser. |
Per review feedback — bpk-border-size-lg * 2 is a compile-time constant, so it doesn't need a runtime calc(). Only the color needs var().
|
Visit https://backpack.github.io/storybook-prs/4932 to see this build running in a browser. |
|
Token value audit — verified every new CSS var introduced in this PR against
All new/old values match — no visual regression risk from this migration. |
Closes #4836
Summary
BpkDialog.module.scss: replaces static SASS tokens withvar()+ SASS fallbacks for icon border, background colours (--bpk-core-accent,--bpk-status-warning-spot,--bpk-status-danger-spot), and icon fill (--bpk-text-inverse), and the icon border colour (--bpk-surface-default)BpkDialogInner.module.scss: adds/* gap: ... */comments on tokens that don't have CSS var equivalents yet ($bpk-zindex-modal,$bpk-duration-sm,$bpk-modal-background-color,$bpk-modal-content-padding,$bpk-modal-max-width,$bpk-modal-opacity,$bpk-modal-initial-opacity), and migrates$bpk-surface-contrast-day→var(--bpk-surface-contrast, ...)DarkModeStorybook story usingBpkDarkExampleWrapperTest plan
pnpm jest --testPathPatterns=bpk-component-dialog)🤖 Generated with Claude Code