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

[CLOV-CSS] Migrate bpk-component-inset-banner to CSS custom properties - #4924

Merged
Vincent Liu (xiaogliu) merged 3 commits into
mainfrom
migrate/css-vars-inset-banner-4842
Jul 23, 2026
Merged

Vincent Liu (xiaogliu) merged 3 commits into
mainfrom
migrate/css-vars-inset-banner-4842

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4842

Summary

Migrates `bpk-component-inset-banner` (v1, v2, v3) SCSS to CSS custom properties with SASS token fallbacks for light/dark mode theming.

Tokens migrated

SASS token CSS var
`$bpk-border-radius-sm` `var(--bpk-radius-sm, ...)`
`$bpk-private-info-banner-default-day` `var(--bpk-private-info-banner-default, ...)`
`$bpk-text-on-dark-day` `var(--bpk-text-on-dark, ...)`
`$bpk-text-on-light-day` `var(--bpk-text-on-light, ...)`

Gap tokens (kept bare, annotated with comments)

  • `$bpk-font-color-base` — no semantic CSS var
  • `$bpk-icon-size-lg` — icon dimension
  • `$bpk-line-height-8-xl` — typography line-height
  • `$bpk-private-button-link-normal/pressed-foreground-day` — no CSS var equivalent

Other changes

  • Adds dark mode story using `BpkDarkExampleWrapper`
  • No `themeAttributes.tsx` changes needed

🤖 Generated with Claude Code

Closes #4842

Migrate all three SCSS files (v1, v2, v3) to use CSS custom properties
with SASS token fallbacks for theme-aware styling:
- border-radius: var(--bpk-radius-sm)
- color/fill: var(--bpk-text-on-light), var(--bpk-text-on-dark)
- background-color: var(--bpk-private-info-banner-default)

Gap tokens annotated with comments:
- font-color-base, icon sizes, line-height, button-link colors

Adds dark mode story using BpkDarkExampleWrapper.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 22, 2026 07:52

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-inset-banner (v1/v2/v3) styling from pure SCSS tokens to CSS custom properties with SASS token fallbacks, and adds a Storybook dark mode example to validate theming.

Changes:

  • Replaced key SCSS tokens with CSS custom properties (with token fallbacks) for radius, text colors, and info banner background.
  • Annotated “gap” tokens that intentionally remain as raw SCSS tokens.
  • Added a dark mode Storybook story using BpkDarkExampleWrapper.

Reviewed changes

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

File Description
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.module.scss Switches radius/text colors to CSS vars with token fallbacks for V3.
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBannerV2/BpkInsetBannerSponsored.module.scss Switches radius/text colors to CSS vars with token fallbacks for V2 Sponsored; annotates unmigrated “gap” tokens.
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBanner.stories.tsx Adds a dark mode story wrapper and new DarkMode story render.
packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBanner.module.scss Switches radius/text colors/background to CSS vars with token fallbacks; annotates unmigrated “gap” tokens.

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

body={{
text: 'You can change your destination, date of travel, or both, with no change fee. Valid for all new bookings made up to 31 May for travel between now and 31 December 2020.',
linkText: 'More information',
link: 'www.skyscanner.net',

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.

This story content (the relative link string) pre-existed on main before this PR — not introduced by this migration. Leaving as-is to keep this PR scoped to the CSS custom properties migration; worth a separate cleanup PR if desired.

Comment on lines +157 to +175
const DarkModeExample = () => (
<BpkDarkExampleWrapper>
<BpkInsetBanner
title="Lorem ipsum"
subheadline="Lorem ipsum dolor sit amet"
logo="https://content.skyscnr.com/m/3f4dadbd41da8235/original/Skyland_White_172x96.png"
backgroundColor="#FF6601"
callToAction={{
text: 'Sponsored',
}}
body={{
text: 'You can change your destination, date of travel, or both, with no change fee. Valid for all new bookings made up to 31 May for travel between now and 31 December 2020.',
linkText: 'More information',
link: 'www.skyscanner.net',
}}
variant={VARIANT.onDark}
/>
</BpkDarkExampleWrapper>
);

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.

This is an existing story pattern that pre-dates this PR — the missing accessibilityLabel isn't something this migration introduced. Out of scope for a token-value migration PR; worth a follow-up if the team wants to standardize story examples.

Comment on lines +27 to +31
border-radius: var(--bpk-radius-sm, tokens.$bpk-border-radius-sm);

&--with-body {
border-radius: tokens.$bpk-border-radius-sm tokens.$bpk-border-radius-sm 0 0;
border-radius: var(--bpk-radius-sm, tokens.$bpk-border-radius-sm)
var(--bpk-radius-sm, tokens.$bpk-border-radius-sm) 0 0;

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.

Pre-existing pattern — the repeated $bpk-border-radius-sm already existed on main before this migration (both --with-body radius declarations). This PR migrated each occurrence to var() in place to keep the diff minimal and preserve existing behavior. Extracting a shared local custom property would be a nice follow-up but isn't something this token-migration PR should take on.

Comment on lines +100 to +101
border-radius: 0 0 var(--bpk-radius-sm, tokens.$bpk-border-radius-sm)
var(--bpk-radius-sm, tokens.$bpk-border-radius-sm);

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.

Same as the earlier comment on this pattern — pre-existing duplication, not introduced by this PR.

Comment on lines +28 to +29
color: var(--bpk-text-on-light, tokens.$bpk-text-on-light-day);
fill: var(--bpk-text-on-light, tokens.$bpk-text-on-light-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.

Pre-existing pattern, not introduced by this PR — the fill/color duplication already existed on main before this migration (both lines set independently to the same SASS token). This PR just migrated both to var() in parallel to preserve identical behavior. A currentColor refactor would be a nice follow-up cleanup but is out of scope for a pure token-value migration.

Comment on lines +33 to +34
color: var(--bpk-text-on-dark, tokens.$bpk-text-on-dark-day);
fill: var(--bpk-text-on-dark, tokens.$bpk-text-on-dark-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.

Same as the previous comment — pre-existing duplication, not introduced by this PR. Out of scope for this migration.

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

  • --bpk-radius-sm (0.5rem) matches $bpk-border-radius-sm — consistent across all 4 call sites in this file and the sibling V2/V3 files.
  • --bpk-text-on-light / --bpk-text-on-dark values confirmed against theme-backpack-light/dark.css, match $bpk-text-on-light-day (#161616) / $bpk-text-on-dark-day respectively — every color/fill pair was updated together, no missed siblings.
  • --bpk-private-info-banner-default (light #eff3f8 / dark #131d2b) matches $bpk-private-info-banner-default-day exactly.

All new vars confirmed to exist in the theme CSS files, values verified.

@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 9fc2ab5 into main Jul 23, 2026
20 of 21 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-inset-banner-4842 branch July 23, 2026 08:13
@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-radius-sm $bpk-border-radius-sm 0.5rem (no dark override — rem/radius values are theme-agnostic) ✅
--bpk-text-on-light $bpk-text-on-light-day #161616 #010913 ✅
--bpk-text-on-dark $bpk-text-on-dark-day #ffffff #ffffff ✅
--bpk-private-info-banner-default $bpk-private-info-banner-default-day #eff3f8 #131d2b ✅

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

3 participants