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

[CLOV-CSS] Migrate bpk-component-drawer to CSS custom properties - #4920

Merged
Vincent Liu (xiaogliu) merged 4 commits into
mainfrom
migrate/bpk-component-drawer-css-vars-4837
Jul 23, 2026
Merged

Vincent Liu (xiaogliu) merged 4 commits into
mainfrom
migrate/bpk-component-drawer-css-vars-4837

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4837

Summary

Migrates BpkDrawerContent.module.scss to use CSS custom properties with SASS token fallbacks, enabling light/dark theme support.

Migrated tokens:

  • tokens.$bpk-surface-default-day → var(--bpk-surface-default, tokens.$bpk-surface-default-day) (drawer background)
  • tokens.$bpk-line-day → var(--bpk-other-line-default, tokens.$bpk-line-day) (secondary panel border)

Gap tokens (no CSS var available yet — annotated with comments):

  • tokens.$bpk-duration-base — /* gap: animation duration */
  • tokens.$bpk-modal-initial-opacity — /* gap: animation opacity */
  • tokens.$bpk-modal-opacity — /* gap: opacity */
  • tokens.$bpk-zindex-drawer — /* gap: z-index */

Stories: Added DarkMode story using BpkDarkExampleWrapper.

No themeAttributes.tsx changes needed — the drawer delegates to link theme attributes only.

Test plan

  • All 12 existing drawer tests pass
  • SCSS linting passes (stylelint)
  • ESLint passes

Migrates BpkDrawerContent.module.scss to use CSS custom properties with
SASS token fallbacks for surface-default background and border colours.
Adds gap comments for animation duration, opacity, and z-index tokens.
Adds a DarkMode story using BpkDarkExampleWrapper.

Closes #4837

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 22, 2026 07:41
@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 the drawer’s SCSS to CSS custom properties (with SASS fallbacks) to support theming, and adds a Storybook dark mode example.

Changes:

  • Updated drawer background and secondary panel border color tokens to use CSS custom properties with SASS fallback values.
  • Annotated remaining non-migrated tokens (“gap” tokens) inline in the SCSS.
  • Added a DarkMode Storybook story wrapped in BpkDarkExampleWrapper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawerContent.module.scss Migrates select tokens to CSS custom properties and annotates non-migrated tokens.
packages/backpack-web/src/bpk-component-drawer/src/BpkDrawer.stories.js Adds a dark mode Storybook example using BpkDarkExampleWrapper.

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

Comment on lines +35 to +38
transition:
transform tokens.$bpk-duration-base ease,
width tokens.$bpk-duration-base ease;
/* gap: animation duration */ width tokens.$bpk-duration-base ease; /* 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.

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.

/* gap: animation duration */ transform tokens.$bpk-duration-base
ease-in-out; /* gap: animation duration */

opacity: tokens.$bpk-modal-initial-opacity; /* gap: animation opacity */

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.

&--entered {
transform: scale(1);
opacity: tokens.$bpk-modal-opacity;
opacity: tokens.$bpk-modal-opacity; /* gap: opacity */

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.

&--exited {
transform: scale(0.9);
opacity: tokens.$bpk-modal-initial-opacity;
opacity: tokens.$bpk-modal-initial-opacity; /* gap: animation opacity */

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

Fix indentation and remove stray blank lines left over from removing the
/* gap: */ comments — was failing prettier/prettier and
declaration-empty-line-before lint rules in CI.
@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 9f07bbe into main Jul 23, 2026
15 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/bpk-component-drawer-css-vars-4837 branch July 23, 2026 08:18
@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-other-line-default $bpk-line-day #c1c7cf rgba(255, 255, 255, 0.2) ✅

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

3 participants