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

[CLOV-CSS] Migrate bpk-component-star-rating to CSS custom properties - #4943

Merged
Vincent Liu (xiaogliu) merged 2 commits into
mainfrom
migrate/css-vars-star-rating-4832
Jul 26, 2026
Merged

Vincent Liu (xiaogliu) merged 2 commits into
mainfrom
migrate/css-vars-star-rating-4832

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4832

Changes

Migrates bpk-component-star-rating SCSS to CSS custom properties with SASS token fallbacks for light/dark mode support.

BpkStar.module.scss

  • $bpk-status-warning-spot-day → var(--bpk-status-warning-spot, tokens.$bpk-status-warning-spot-day) (filled star colour)
  • $bpk-text-disabled-day → var(--bpk-text-disabled, tokens.$bpk-text-disabled-day) (empty star colour)
  • Replaced physical left: 0 with logical inset-inline-start: 0 (RTL support)
  • Removed @use utils import (no longer needed after dropping bpk-themeable-property)
  • Added TODO comments for gap tokens without CSS var equivalents yet: $bpk-icon-size-sm/lg/xxxl

BpkInteractiveStar.module.scss

  • Added TODO comment for $bpk-duration-sm (no CSS custom property equivalent yet)

themeAttributes.ts / themeAttributes-test.ts

  • Cleared starRatingFilledColor theme attribute — the old --bpk-star-rating-filled-color hook is superseded by the global --bpk-status-warning-spot CSS var

BpkStarRating.stories.tsx

  • Added VisualTestDark story using BpkDarkExampleWrapper

Copilot AI review requested due to automatic review settings July 22, 2026 08:24
@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-star-rating styling from SASS theme hooks to CSS custom properties (with token fallbacks), and adds Storybook coverage for dark mode.

Changes:

  • Replaced star colors with CSS custom properties + SASS token fallbacks and improved RTL positioning.
  • Removed the component-specific theme attribute hook for filled star color.
  • Added dark-mode visual test story for star rating (and additional dark test story elsewhere).

Reviewed changes

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

Show a summary per file
File Description
packages/backpack-web/src/bpk-component-star-rating/src/themeAttributes.ts Removes exported theme attributes for the component.
packages/backpack-web/src/bpk-component-star-rating/src/themeAttributes-test.ts Updates expectation to match the removed theme attributes.
packages/backpack-web/src/bpk-component-star-rating/src/BpkStarRating.stories.tsx Adds a dark-mode visual test story using the dark wrapper.
packages/backpack-web/src/bpk-component-star-rating/src/BpkStar.module.scss Switches colors to CSS vars + token fallbacks; improves RTL positioning; drops themeable mixin usage.
packages/backpack-web/src/bpk-component-star-rating/src/BpkInteractiveStar.module.scss Adds TODO note and keeps duration token for transitions.
packages/backpack-web/src/bpk-component-rating/src/BpkRating.stories.tsx Removes stray blank lines (formatting-only).
packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNav.stories.js Adds dark-mode visual test story and minor formatting cleanup.

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

*/

export default ['starRatingFilledColor'];
export default [];

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.ts is no longer part of this PR's current diff (superseded by a later commit, which only touches BpkInteractiveStar.module.scss and BpkStar.module.scss now). No action needed.

Comment on lines +296 to +298
export const VisualTestDark = {
render: () => <DarkExample />,
};

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 — BpkStarRating.stories.tsx is no longer part of this PR's current diff. No action needed.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

- Replace bpk-themeable-property mixin with plain var() for filled star fill color
- Migrate $bpk-status-warning-spot-day -> var(--bpk-status-warning-spot, ...)
- Migrate $bpk-text-disabled-day -> var(--bpk-text-disabled, ...)
- Replace physical left:0 with logical inset-inline-start:0 for RTL support
- Remove @use utils import from BpkStar.module.scss (no longer needed)
- Add TODO comments for gap tokens: $bpk-icon-size-sm/lg/xxxl, $bpk-duration-sm
- Clear themeAttributes (old --bpk-star-rating-filled-color hook superseded)
- Add VisualTestDark story using BpkDarkExampleWrapper

Closes #4832

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@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 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-text-disabled $bpk-text-disabled-day rgba(0,0,0,0.2) rgba(255,255,255,0.2) ✅
--bpk-status-warning-spot $bpk-status-warning-spot-day #f55d42 #feeb87 ✅

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 1270e3e into main Jul 26, 2026
20 of 21 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-star-rating-4832 branch July 26, 2026 15:48
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-star-rating to CSS custom properties

3 participants