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

[CLOV-CSS] Migrate bpk-component-dialog to CSS custom properties - #4932

Merged
Vincent Liu (xiaogliu) merged 5 commits into
mainfrom
migrate/css-vars-dialog-4836
Jul 23, 2026
Merged

Vincent Liu (xiaogliu) merged 5 commits into
mainfrom
migrate/css-vars-dialog-4836

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4836

Summary

  • Migrates BpkDialog.module.scss: replaces static SASS tokens with var() + 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)
  • Migrates 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, ...)
  • Adds a DarkMode Storybook story using BpkDarkExampleWrapper

Test plan

  • All existing tests pass (pnpm jest --testPathPatterns=bpk-component-dialog)
  • Storybook renders correctly in light and dark modes
  • Visual regression tests pass

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 22, 2026 07:58
@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-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 DarkMode Storybook story via BpkDarkExampleWrapper.

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.

Comment on lines +29 to +31
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 */

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.

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 */

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.

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});

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.

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.

Comment on lines +62 to +63
border: calc(#{tokens.$bpk-border-size-lg} * 2)
var(--bpk-surface-default, #{tokens.$bpk-surface-default-day}) solid;

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.

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]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@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.

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.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Leftover from removing the /* gap: */ comments — was failing the
declaration-empty-line-before lint rule in CI.
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

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().
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@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 aa0cda5 into main Jul 23, 2026
15 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-dialog-4836 branch July 23, 2026 05:50
@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-default $bpk-surface-default-day #ffffff #131d2b ✅
--bpk-core-accent $bpk-core-accent-day #0062e3 #84e9ff ✅
--bpk-status-warning-spot $bpk-status-warning-spot-day #f55d42 #feeb87 ✅
--bpk-status-danger-spot $bpk-status-danger-spot-day #e70866 #ff649c ✅
--bpk-text-inverse $bpk-text-primary-inverse-day #ffffff #010913 ✅
--bpk-surface-contrast $bpk-surface-contrast-day #05203c #010913 ✅

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

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-dialog to CSS custom properties

3 participants