[CLOV-CSS] Migrate bpk-component-info-banner to CSS custom properties - #4950
Conversation
- 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>
|
Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser. |
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-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.scssto use CSS variables with token fallbacks for key colors. - Added
themeAttributes.tsx+ tests to expose newallInfoBannerThemeAttributesand keep the legacy deprecatedthemeAttributes. - 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. |
| export const allInfoBannerThemeAttributes = [ | ||
| 'privateInfoBannerDefault', | ||
| 'privateInfoBannerOnContrast', | ||
| ]; |
| export const allInfoBannerThemeAttributes = [ | ||
| 'privateInfoBannerDefault', | ||
| 'privateInfoBannerOnContrast', | ||
| ]; |
| * Use allInfoBannerThemeAttributes for the complete list. | ||
| * Will be removed in the next major release. | ||
| */ | ||
| const themeAttributes = ['infoBannerBackgroundColor']; |
| import themeAttributes, { allInfoBannerThemeAttributes } from '../index'; | ||
|
|
||
| describe('info-banner component themeAttributes', () => { |
|
Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser. |
|
Token value audit — verified every new CSS var against
All migrated declarations check out — 7 vars, values match exactly. &--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 For reference: 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>
|
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).
|
Visit https://backpack.github.io/storybook-prs/4950 to see this build running in a browser. |
Closes #4828
Summary
BpkInfoBanner.module.scssto use CSS custom properties (CSS vars) with SASS token fallbacksthemeAttributes.tsxexposingprivateInfoBannerDefaultandprivateInfoBannerOnContrastas themeable keysthemeAttributes-test.tsxwith test assertionsindex.tsto exportthemeAttributesandallInfoBannerThemeAttributesVisualTestDarkstoryTokens migrated
$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-inverseGaps (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