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

[CLOV-CSS] Migrate bpk-component-info-banner to CSS custom properties - #4950

Merged
Vincent Liu (xiaogliu) merged 4 commits into
mainfrom
migrate/css-vars-info-banner-4828
Jul 27, 2026
Merged

Vincent Liu (xiaogliu) merged 4 commits into
mainfrom
migrate/css-vars-info-banner-4828

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4828

Summary

  • Migrated BpkInfoBanner.module.scss to use CSS custom properties (CSS vars) with SASS token fallbacks
  • Added themeAttributes.tsx exposing privateInfoBannerDefault and privateInfoBannerOnContrast as themeable keys
  • Added themeAttributes-test.tsx with test assertions
  • Updated index.ts to export themeAttributes and allInfoBannerThemeAttributes
  • Added dark mode VisualTestDark story

Tokens migrated

SASS token CSS var
$bpk-private-info-banner-default-day --bpk-private-info-banner-default
$bpk-private-info-banner-on-contrast-day --bpk-private-info-banner-on-contrast
$bpk-text-primary-day --bpk-text-primary
$bpk-text-secondary-day --bpk-text-secondary
$bpk-text-primary-inverse-day --bpk-text-inverse

Gaps (no CSS var equivalent — left unchanged)

  • $bpk-private-info-banner-error-day
  • $bpk-private-info-banner-success-day
  • $bpk-private-info-banner-warning-day
  • $bpk-duration-sm

🤖 Generated with Claude Code

- Replace static SASS tokens with CSS var() wrappers in BpkInfoBanner.module.scss
- Migrated: --bpk-private-info-banner-default, --bpk-private-info-banner-on-contrast,
  --bpk-text-primary, --bpk-text-secondary, --bpk-text-inverse
- Left as-is (no CSS var equivalent): bpk-private-info-banner-error/success/warning-day,
  bpk-duration-sm
- Add themeAttributes.tsx for private info-banner vars
- Add themeAttributes-test.tsx with assertions
- Export themeAttributes from index.ts
- Add dark mode VisualTestDark story

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 08:43
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser.

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-info-banner styling to use CSS custom properties with SASS token fallbacks, and exposes theme attribute keys (including tests) while adding a dark-mode visual test story.

Changes:

  • Updated BpkInfoBanner.module.scss to use CSS variables with token fallbacks for key colors.
  • Added themeAttributes.tsx + tests to expose new allInfoBannerThemeAttributes and keep the legacy deprecated themeAttributes.
  • Exported theme attributes from the package entrypoint and added a dark-mode Storybook visual test.

Reviewed changes

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

Show a summary per file
File Description
packages/backpack-web/src/bpk-component-info-banner/src/themeAttributes.tsx Adds new exported theme attribute key list and keeps deprecated legacy list.
packages/backpack-web/src/bpk-component-info-banner/src/themeAttributes-test.tsx Adds assertions for the legacy and new theme attribute exports.
packages/backpack-web/src/bpk-component-info-banner/src/BpkInfoBanner.stories.js Adds a VisualTestDark story configuration.
packages/backpack-web/src/bpk-component-info-banner/src/BpkInfoBanner.module.scss Switches selected tokens to CSS custom properties with SASS fallbacks.
packages/backpack-web/src/bpk-component-info-banner/index.ts Re-exports theme attribute lists from package entrypoint.

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

*/

/**
* Combined deduplicated array of all info-banner private theme attributes.
Comment on lines +24 to +27
export const allInfoBannerThemeAttributes = [
'privateInfoBannerDefault',
'privateInfoBannerOnContrast',
];
Comment on lines +24 to +27
export const allInfoBannerThemeAttributes = [
'privateInfoBannerDefault',
'privateInfoBannerOnContrast',
];
* Use allInfoBannerThemeAttributes for the complete list.
* Will be removed in the next major release.
*/
const themeAttributes = ['infoBannerBackgroundColor'];
Comment on lines +19 to +21
import themeAttributes, { allInfoBannerThemeAttributes } from '../index';

describe('info-banner component themeAttributes', () => {
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser.

@xiaogliu

Vincent Liu (xiaogliu) commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Token value audit — verified every new CSS var against token-sync/css/theme-backpack-light.css / theme-backpack-dark.css and base.default.scss:

CSS var Old SASS fallback Light value Dark value Match
--bpk-private-info-banner-default $bpk-private-info-banner-default-day #eff3f8 #131d2b
--bpk-private-info-banner-on-contrast $bpk-private-info-banner-on-contrast-day #ffffff #131d2b
--bpk-text-secondary (x2) $bpk-text-secondary-day #626971 #bdc4cb
--bpk-text-inverse (x4) $bpk-text-primary-inverse-day #ffffff #010913
--bpk-text-primary $bpk-text-primary-day #161616 #ffffff

All migrated declarations check out — 7 vars, values match exactly.

⚠️ One line was NOT migrated, and it's the same rule block as a migrated sibling:

&--critical {
  background-color: tokens.$bpk-private-info-banner-error-day;   // ← still a bare SASS token
  color: var(--bpk-text-inverse, tokens.$bpk-text-primary-inverse-day);  // ← migrated
}

No CSS var currently exists for $bpk-private-info-banner-error-day (confirmed — searched both theme CSS files, no --bpk-private-info-banner-error or similar). So this background-color genuinely can't respond to dark mode today, unlike its sibling color declaration in the same rule.

For reference: $bpk-private-info-banner-error-day = rgb(231,8,102) = #e70866, which happens to equal the light value of the existing global var --bpk-status-danger-spot — but --bpk-status-danger-spot's dark value (#ff649c) is different from this component's dark SASS token (need to check -error-night if one exists), so this isn't a safe drop-in substitution without design confirmation on whether info-banner's critical background should track the global danger-spot colour or needs its own dedicated var added to the theme files.


I'm confirming with contributor, I think we can replace tokens.$bpk-private-info-banner-error-day with --bpk-status-danger-spot. https://github.com/Skyscanner/backpack/pull/4950/changes#r3654951177

Updated in 0ff7de6, PR LGTM.

…oBanner.module.scss

Co-authored-by: Vincent Liu <xiaogliu@outlook.com>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser.

Was failing prettier/prettier lint rule (line exceeded 80 chars).
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser.

@xiaogliu
Vincent Liu (xiaogliu) merged commit fbb1b51 into main Jul 27, 2026
15 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-info-banner-4828 branch July 27, 2026 07:23
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-info-banner to CSS custom properties

3 participants