Repository navigation
[CLOV-CSS] Migrate bpk-component-price-range to CSS custom properties - #4931
Conversation
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-price-range styling toward CSS custom properties (with Sass token fallbacks) and adds a dark-mode visual regression Storybook entry.
Changes:
- Replaced multiple SCSS design tokens with
var(--*, token-fallback)inBpkPriceRangeandBpkPriceMarkerstyles for themeability. - Added a
VisualTestDarkstory usingBpkDarkExampleWrapperto validate dark mode rendering. - Also updates
BpkTooltip.module.scssto use CSS custom properties for a few colors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.module.scss | Switches select tooltip colors to CSS custom properties with token fallbacks. |
| packages/backpack-web/src/bpk-component-price-range/src/BpkPriceRange.stories.tsx | Adds a dark-mode Percy/visual test story wrapper. |
| packages/backpack-web/src/bpk-component-price-range/src/BpkPriceRange.module.scss | Migrates key colors/radii to CSS vars with Sass fallbacks. |
| packages/backpack-web/src/bpk-component-price-range/src/BpkPriceMarker.module.scss | Migrates marker colors/radii to CSS vars with Sass fallbacks; documents shadow gap. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $dark-background-color: var( | ||
| --bpk-surface-contrast, | ||
| tokens.$bpk-surface-contrast-day | ||
| ); | ||
|
|
||
| .bpk-tooltip--container { | ||
| z-index: tokens.$bpk-zindex-tooltip; | ||
| z-index: tokens.$bpk-zindex-tooltip; /* gap: z-index, not in token-sync */ |
There was a problem hiding this comment.
Outdated — the tooltip file is no longer part of this PR's diff (removed in a later commit), so scope is now consistent with the title/description. No action needed.
| border-end-start-radius: var( | ||
| --bpk-radius-sm, | ||
| tokens.$bpk-border-radius-sm | ||
| ); | ||
| border-start-start-radius: var( | ||
| --bpk-radius-sm, | ||
| tokens.$bpk-border-radius-sm | ||
| ); | ||
|
|
||
| &Large { | ||
| border-end-start-radius: tokens.$bpk-border-radius-md; | ||
| border-start-start-radius: tokens.$bpk-border-radius-md; | ||
| border-end-start-radius: var( | ||
| --bpk-radius-md, | ||
| tokens.$bpk-border-radius-md | ||
| ); | ||
| border-start-start-radius: var( | ||
| --bpk-radius-md, | ||
| tokens.$bpk-border-radius-md | ||
| ); |
There was a problem hiding this comment.
Pre-existing pattern, not introduced by this PR — the repeated $bpk-border-radius-sm/-md values already existed on main before this migration (border-end-start-radius / border-start-start-radius pairs). This PR migrated each occurrence to var() in place to keep the diff minimal and preserve existing behavior; extracting a shared local variable would be a good follow-up but is out of scope for this token-value migration.
There was a problem hiding this comment.
We will remove the fallback variable in the future, no need extract the expression.
| const DarkExample = () => ( | ||
| <BpkDarkExampleWrapper> | ||
| <MixedExample /> | ||
| </BpkDarkExampleWrapper> | ||
| ); | ||
|
|
||
| export const VisualTestDark = { | ||
| render: () => <DarkExample />, | ||
| parameters: { | ||
| percy: { | ||
| waitForTimeout: 10000, | ||
| }, | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Outdated — the DarkExample story this comment refers to is no longer present in the current diff (removed/reworked in a later commit). No action needed.
c6cde99 to
7f0f9f8
Compare
|
Visit https://backpack.github.io/storybook-prs/4931 to see this build running in a browser. |
Replaces bare SASS tokens with var()/fallback pairs: - $bpk-border-radius-xs/sm/md → var(--bpk-radius-xs/sm/md) - $bpk-core-primary-day → var(--bpk-core-primary) - $bpk-status-danger-spot-day → var(--bpk-status-danger-spot) - $bpk-status-success-spot-day → var(--bpk-status-success-spot) - $bpk-text-primary-inverse-day → var(--bpk-text-inverse) - $bpk-box-shadow-sm kept bare (no CSS var available) Adds VisualTestDark story using BpkDarkExampleWrapper. Closes #4818 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
7f0f9f8 to
79473ef
Compare
|
Visit https://backpack.github.io/storybook-prs/4931 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 #4818
Summary
Migrates
bpk-component-price-rangeSCSS to CSS custom properties with SASS fallbacks for light/dark mode support.Changes
BpkPriceRange.module.scss— 12 CSS var replacements:$bpk-status-success-spot-day→var(--bpk-status-success-spot, ...)$bpk-core-primary-day→var(--bpk-core-primary, ...)$bpk-status-danger-spot-day→var(--bpk-status-danger-spot, ...)$bpk-text-primary-inverse-day→var(--bpk-text-inverse, ...)$bpk-border-radius-sm/md→var(--bpk-radius-sm/md, ...)BpkPriceMarker.module.scss— 6 CSS var replacements:$bpk-border-radius-xs→var(--bpk-radius-xs, ...)$bpk-text-primary-inverse-day→var(--bpk-text-inverse, ...)$bpk-status-success-spot-day→var(--bpk-status-success-spot, ...)$bpk-core-primary-day→var(--bpk-core-primary, ...)$bpk-status-danger-spot-day→var(--bpk-status-danger-spot, ...)$bpk-box-shadow-smkept as bare SASS token (no CSS var equivalent)BpkPriceRange.stories.tsx— AddsVisualTestDarkstory usingBpkDarkExampleWrapper.No
themeAttributes.tsxneeded — the component has none.Test plan