Repository navigation
[CLOV-CSS] Migrate bpk-component-inset-banner to CSS custom properties - #4924
Conversation
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]>
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-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', |
There was a problem hiding this comment.
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.
| 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> | ||
| ); |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
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.
| border-radius: 0 0 var(--bpk-radius-sm, tokens.$bpk-border-radius-sm) | ||
| var(--bpk-radius-sm, tokens.$bpk-border-radius-sm); |
There was a problem hiding this comment.
Same as the earlier comment on this pattern — pre-existing duplication, not introduced by this PR.
| color: var(--bpk-text-on-light, tokens.$bpk-text-on-light-day); | ||
| fill: var(--bpk-text-on-light, tokens.$bpk-text-on-light-day); |
There was a problem hiding this comment.
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.
| color: var(--bpk-text-on-dark, tokens.$bpk-text-on-dark-day); | ||
| fill: var(--bpk-text-on-dark, tokens.$bpk-text-on-dark-day); |
There was a problem hiding this comment.
Same as the previous comment — pre-existing duplication, not introduced by this PR. Out of scope for this migration.
|
Visit https://backpack.github.io/storybook-prs/4924 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.
--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-darkvalues confirmed against theme-backpack-light/dark.css, match$bpk-text-on-light-day(#161616) /$bpk-text-on-dark-dayrespectively — everycolor/fillpair was updated together, no missed siblings.--bpk-private-info-banner-default(light #eff3f8 / dark #131d2b) matches$bpk-private-info-banner-default-dayexactly.
All new vars confirmed to exist in the theme CSS files, values verified.
|
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 #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
Gap tokens (kept bare, annotated with comments)
Other changes
🤖 Generated with Claude Code