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

[CLOV-CSS] Migrate bpk-component-map to CSS custom properties - #4954

Merged
Vincent Liu (xiaogliu) merged 4 commits into
mainfrom
migrate/css-vars-map-4841
Jul 26, 2026
Merged

Vincent Liu (xiaogliu) merged 4 commits into
mainfrom
migrate/css-vars-map-4841

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Summary

  • Migrates bpk-component-map SCSS files to use CSS custom properties with SASS fallbacks
  • Replaces bare tokens.$bpk-*-day values with var(--bpk-*, tokens.$bpk-*-day) pattern
  • BpkPriceMarkerButton.module.scss: migrates border-radius, text-on-dark, text-on-light, core-primary, and private-map-previous-selection tokens
  • BpkIconMarkerBackground.module.scss: migrates core-primary for selected fill and stroke
  • BpkIconMarker.module.scss: migrates surface-default for icon color
  • DefaultLoadingElement.module.scss: migrates surface-highlight for background
  • Creates themeAttributes.tsx exposing privateMapPreviousSelection and privateMapPoiPin private map vars
  • Creates themeAttributes-test.tsx with coverage for the new TypeScript theme attributes
  • Adds DarkPriceMarkers story using BpkDarkExampleWrapper for dark mode visual coverage

Closes #4841

🤖 Generated with Claude Code

- Replace bare SASS tokens with CSS var() + SASS fallbacks in all SCSS files
- BpkPriceMarkerButton: migrate border-radius, text-on-dark, text-on-light, core-primary, private-map-previous-selection
- BpkIconMarkerBackground: migrate core-primary, surface-default (icon color)
- DefaultLoadingElement: migrate surface-highlight
- Create themeAttributes.tsx with privateMapPreviousSelection and privateMapPoiPin
- Create themeAttributes-test.tsx
- Add DarkPriceMarkers story using BpkDarkExampleWrapper

Closes #4841

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 22, 2026 08:55
@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 bpk-component-map styling to prefer CSS custom properties (with Sass fallbacks) and adds supporting theme attribute exports plus Storybook coverage for dark mode price markers.

Changes:

  • Replaced several hard-coded day tokens in SCSS with var(--bpk-…, tokens.$…-day) fallbacks.
  • Added themeAttributes export + test for private map theming attributes.
  • Added a dark-mode Storybook story for price markers.

Reviewed changes

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

Show a summary per file
File Description
packages/backpack-web/src/bpk-component-map/src/themeAttributes.tsx Introduces exported list of private map theme attributes.
packages/backpack-web/src/bpk-component-map/src/themeAttributes-test.tsx Adds a unit test asserting the theme attribute list.
packages/backpack-web/src/bpk-component-map/src/DefaultLoadingElement.module.scss Uses CSS custom property fallback for surface-highlight background.
packages/backpack-web/src/bpk-component-map/src/BpkPriceMarkerButton.module.scss Migrates price marker button colors and radius to CSS custom properties.
packages/backpack-web/src/bpk-component-map/src/BpkMap.stories.js Adds dark-mode price marker Storybook story.
packages/backpack-web/src/bpk-component-map/src/BpkIconMarkerBackground.module.scss Uses CSS custom property fallback for selected marker fill.
packages/backpack-web/src/bpk-component-map/src/BpkIconMarker.module.scss Uses CSS custom property fallback for icon color.

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

justify-content: center;
align-items: center;
border-radius: tokens.$bpk-border-radius-sm;
border-radius: 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.

Not a problem — --bpk-radius-sm is the correct, actual existing CSS var name in this codebase (confirmed present in token-sync/css/primitives.css, value 0.5rem, matching $bpk-border-radius-sm). It's not a 1:1 rename of the SASS token name — the CSS var system uses shorter semantic names by design, and --bpk-radius-sm is the same convention already used repo-wide (e.g. the _radii.scss mixin: border-radius: var(--bpk-radius-sm, tokens.$bpk-border-radius-sm);). No change needed.

Comment on lines +24 to +29
const mapThemeAttributes: string[] = [
'privateMapPreviousSelection',
'privateMapPoiPin',
];

export default mapThemeAttributes;

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 — themeAttributes.tsx is no longer part of this PR's current diff (superseded by a later commit on this branch). No action needed.

Comment on lines +24 to +27
const mapThemeAttributes: string[] = [
'privateMapPreviousSelection',
'privateMapPoiPin',
];

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 — themeAttributes.tsx is no longer part of this PR's current diff (superseded by a later commit on this branch). No action needed.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@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-core-primary $bpk-core-primary-day #05203c #054184 ✅
--bpk-radius-sm $bpk-border-radius-sm 0.5rem (no dark override — rem/radius values are theme-agnostic) ✅
--bpk-text-on-dark $bpk-text-on-dark-day #ffffff #ffffff ✅
--bpk-text-on-light $bpk-text-on-light-day #161616 #010913 ✅
--bpk-private-map-previous-selection $bpk-private-map-previous-selection-day #cfe4ff #cfe4ff ✅
--bpk-surface-highlight $bpk-surface-highlight-day #e0e4e9 #243346 ✅

All new/old values match — no visual regression risk from this migration.

@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 08eb7c1 into main Jul 26, 2026
15 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-map-4841 branch July 26, 2026 16:21
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-map to CSS custom properties

3 participants