Repository navigation
[CLOV-CSS] Migrate bpk-component-rating to CSS custom properties - #4944
Conversation
|
Visit https://backpack.github.io/storybook-prs/4944 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 several Backpack web components away from legacy themeable SCSS mixins toward CSS custom properties (with token fallbacks) and adds dark-mode Storybook examples/visual tests.
Changes:
- Replace
utils.bpk-themeable-propertyusage withvar(--token, sass-fallback)in Switch/StarRating/Rating styles. - Remove component-specific
themeAttributesexports for Switch and Star Rating (and update tests). - Add dark-mode Storybook stories/wrappers across multiple components for visual coverage.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-switch/src/themeAttributes.ts | Removes exported theme attributes for Switch. |
| packages/backpack-web/src/bpk-component-switch/src/themeAttributes-test.tsx | Updates Switch themeAttributes test expectation. |
| packages/backpack-web/src/bpk-component-switch/src/BpkSwitch.stories.tsx | Adds dark-mode visual test story. |
| packages/backpack-web/src/bpk-component-switch/src/BpkSwitch.module.scss | Switch styling now uses CSS custom properties (token vars). |
| packages/backpack-web/src/bpk-component-star-rating/src/themeAttributes.ts | Removes exported theme attributes for Star Rating. |
| packages/backpack-web/src/bpk-component-star-rating/src/themeAttributes-test.ts | Updates Star Rating themeAttributes test expectation. |
| packages/backpack-web/src/bpk-component-star-rating/src/BpkStarRating.stories.tsx | Adds dark-mode visual test story. |
| packages/backpack-web/src/bpk-component-star-rating/src/BpkStar.module.scss | Star fill/position updated to token CSS variables + logical properties. |
| packages/backpack-web/src/bpk-component-star-rating/src/BpkInteractiveStar.module.scss | Adds TODO note; no functional change. |
| packages/backpack-web/src/bpk-component-rating/src/BpkRating.stories.tsx | Adds dark-mode Storybook example + tags/params. |
| packages/backpack-web/src/bpk-component-rating/src/BpkRating.module.scss | Rating styles migrated to CSS custom properties + logical properties. |
| packages/backpack-web/src/bpk-component-page-indicator/src/BpkPageIndicator.stories.tsx | Adds dark-mode story and some formatting cleanups. |
| packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNav.stories.js | Adds dark-mode visual test story. |
| packages/backpack-web/src/bpk-component-grid-toggle/src/BpkGridToggle.stories.tsx | Adds dark-mode story. |
| packages/backpack-web/src/bpk-component-grid-toggle/src/BpkGridToggle.module.scss | Uses color-mix() with CSS custom properties for gradient. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| */ | ||
|
|
||
| export default ['switchCheckedColor']; | ||
| export default []; |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| */ | ||
|
|
||
| export default ['starRatingFilledColor']; | ||
| export default []; |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| background: linear-gradient( | ||
| to bottom, | ||
| rgba(tokens.$bpk-status-danger-spot-day, 0.3) 0, | ||
| color-mix( | ||
| in srgb, | ||
| var(--bpk-status-danger-spot, tokens.$bpk-status-danger-spot-day) | ||
| 30%, | ||
| transparent | ||
| ) | ||
| 0, | ||
| transparent tokens.$bpk-one-pixel-rem | ||
| ) | ||
| repeat left 0; | ||
| background-size: tokens.bpk-spacing-sm() tokens.bpk-spacing-sm(); | ||
| background-size: var(--bpk-spacing-sm, tokens.bpk-spacing-sm()) | ||
| var(--bpk-spacing-sm, tokens.bpk-spacing-sm()); |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| export const VisualTestDarkMode = { | ||
| render: () => ( | ||
| <BpkDarkExampleWrapper> | ||
| <MixedExample /> | ||
| </BpkDarkExampleWrapper> | ||
| ), | ||
| }; |
There was a problem hiding this comment.
Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.
| @@ -17,7 +17,6 @@ | |||
| */ | |||
|
|
|||
| @use '../../bpk-mixins/tokens'; | |||
There was a problem hiding this comment.
Outdated — this comment refers to the PR's earlier broader scope (switch/star-rating/grid-toggle were part of an earlier commit). The current diff only touches BpkRating.module.scss, so scope is now consistent with the title/description. No action needed.
Replaces bare SASS tokens in BpkRating.module.scss with var(--css-var, sass-fallback) so colours respond to dark mode. - color: tokens.$bpk-text-secondary-day → var(--bpk-text-secondary, ...) for both __scale and __subtitle - padding-top: tokens.$bpk-one-pixel-rem → var(--bpk-spacing-xxs, ...) for __text-wrapper--large - Replaced padding-right + bpk-rtl mixin with padding-inline-end (CSS logical property, handles RTL natively) - Removed now-unused @use '../../bpk-mixins/utils' import Adds VisualTestDark story and tags meta with dark-mode-compatible. Closes #4810 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
8fcfd2f to
0dc5e0a
Compare
|
Visit https://backpack.github.io/storybook-prs/4944 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4944 to see this build running in a browser. |
|
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 #4810
Summary
Migrates
bpk-component-ratingSCSS to CSS custom properties with SASS fallbacks, enabling dark mode support.Changes
BpkRating.module.scss$bpk-text-secondary-day→var(--bpk-text-secondary, tokens.$bpk-text-secondary-day)on__scaleand__subtitle$bpk-one-pixel-rem→var(--bpk-spacing-xxs, ...)on__text-wrapper--largepadding-toppadding-right+bpk-rtlmixin withpadding-inline-end(CSS logical property, handles RTL natively)@use '../../bpk-mixins/utils'importBpkRating.stories.tsxDarkExamplecomponent usingBpkDarkExampleWrapperVisualTestDarkexport withbpkTheme: 'dark'parametertags: ['dark-mode-compatible']to meta