Skip to content

Conversation

@Jack-Waller
Copy link
Member

@Jack-Waller Jack Waller (Jack-Waller) commented Jan 22, 2026

Summary

This PR introduces breaking changes to BpkPriceRange to improve the component API and enable new use cases for price bands display.

Key Changes

  • Make marker prop optional: The component can now display only the price range bars without a marker
  • Add MARKER_DISPLAY_TYPES constant: New exported constant with BUBBLE and DOT options to control marker display style
  • Remove showPriceOnBoundaries prop: Boundary price visibility is now automatically determined by the marker type
  • Default marker type to BUBBLE: When marker is provided without a type, it defaults to BUBBLE behaviour

Boundary Price Visibility Rules

Marker Type Boundary Prices
MARKER_DISPLAY_TYPES.BUBBLE Shown below the bar
MARKER_DISPLAY_TYPES.DOT Hidden (compact display)
No marker Shown below the bar

Checklist

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

Migration Guide

Breaking Changes

  1. showPriceOnBoundaries prop removed

    • Before: Used showPriceOnBoundaries={false} to hide boundary prices
    • After: Use marker={{ type: MARKER_DISPLAY_TYPES.DOT, ... }} for compact display without boundaries
  2. marker.type is now required when using marker with dot style

    • Before: N/A (only bubble style existed)
    • After: Use MARKER_DISPLAY_TYPES.BUBBLE or MARKER_DISPLAY_TYPES.DOT
  3. marker.type defaults to BUBBLE when omitted

    • If you provide a marker without a type, it will default to MARKER_DISPLAY_TYPES.BUBBLE
    • This is non-breaking for existing bubble marker usage

Migration Examples

Before (with boundaries hidden):

<BpkPriceRange
  marker={{ price: '£150', percentage: 50 }}
  showPriceOnBoundaries={false}
  segments={...}
/>
image

After (using dot marker):

import { MARKER_DISPLAY_TYPES } from '@skyscanner/backpack-web/bpk-component-price-range';

<BpkPriceRange
  marker={{ price: '£150', percentage: 50, type: MARKER_DISPLAY_TYPES.DOT }}
  segments={...}
/>

No change to UI:
image

Before (with boundaries shown):

<BpkPriceRange
  marker={{ price: '£150', percentage: 50 }}
  segments={...}
/>
image

After (using bubble marker - default):

// Option 1: Explicit type
<BpkPriceRange
  marker={{ price: '£150', percentage: 50, type: MARKER_DISPLAY_TYPES.BUBBLE }}
  segments={...}
/>

// Option 2: Omit type (defaults to BUBBLE)
<BpkPriceRange
  marker={{ price: '£150', percentage: 50 }}
  segments={...}
/>

No change to UI:
image

Without marker (new use case):

<BpkPriceRange
  segments={{ low: { price: '£100', percentage: 20 }, high: { price: '£200', percentage: 80 } }}
/>
image

References

🤖 Generated with Claude Code

- Updated Props type to make marker optional
- Added conditional rendering logic for marker and dot
- Moved indicatorPercent calculation into useEffect for better performance
- Used useCallback to memoize calcPercentage function
- Added comprehensive test coverage (11 tests total)
- Created NoMarkerWithLabels and NoMarkerWithoutLabels example components
- Updated documentation with usage examples and props table
- Verified functionality with Chrome DevTools and Storybook

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removed useCallback in favour of simpler arrow function approach.
All tests continue to pass.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Moved all conditional logic into dotClassName computation instead of
duplicating checks at render time. This creates a single source of
truth and makes the JSX more readable.

Before: Check type for className, then marker && type && !showPriceIndicator for render
After: Check all conditions for className, then just dotClassName for render

All 11 tests continue to pass.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ake-marker-optional-in-price-range' into feature/LUNA-3186-make-marker-optional-in-price-range
@Jack-Waller Jack Waller (Jack-Waller) added the major Breaking change label Jan 22, 2026
…nges

- Update unit tests to cover all 6 use cases with marker type field
- Update accessibility tests for all use cases
- Rename examples to reflect use cases clearly
- Update stories with new example exports
- Update README with new prop names and migration guide

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4133 to see this build running in a browser.

@Jack-Waller Jack Waller (Jack-Waller) marked this pull request as ready for review January 22, 2026 18:34
Copilot AI review requested due to automatic review settings January 22, 2026 18:34
@Jack-Waller Jack Waller (Jack-Waller) changed the title WIP[LUNA-3186]: Make marker prop optional in BpkPriceRange (Breaking Changes) [LUNA-3186]: Make marker prop optional in BpkPriceRange (Breaking Changes) Jan 22, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements breaking changes to improve the BpkPriceRange component API by making the marker prop optional and renaming showPriceIndicator to the more descriptive showPriceOnBoundaries. The changes add explicit control over marker display types ('bubble' or 'dot') through a new required type field in the marker object.

Changes:

  • Renamed showPriceIndicatorshowPriceOnBoundaries (now required boolean)
  • Made marker prop optional with new required type: 'bubble' | 'dot' field
  • Updated component logic to handle optional marker and explicit type field

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/bpk-component-price-range/src/BpkPriceRange.tsx Core component implementation with renamed prop, optional marker, and explicit type handling
packages/bpk-component-price-range/src/BpkPriceRange-test.tsx Comprehensive test coverage for all 6 use cases with proper test organization
packages/bpk-component-price-range/src/accessibility-test.tsx Accessibility tests covering all 6 use cases
packages/bpk-component-price-range/README.md Updated documentation with new prop names, types, and examples for all use cases
examples/bpk-component-price-range/examples.tsx Renamed and reorganized examples to match the 6 use cases with descriptive naming
examples/bpk-component-price-range/stories.tsx Updated story exports with new example names matching use case structure

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

@skyscanner-backpack-bot
Copy link

skyscanner-backpack-bot bot commented Jan 22, 2026

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 0c67c96

@skyscanner-backpack-bot

This comment was marked as outdated.

…Y_TYPES

BREAKING CHANGE: Remove showPriceOnBoundaries prop - boundary visibility
is now inferred from marker type (dot=hidden, bubble/none=shown).

- Add MARKER_DISPLAY_TYPES constant to replace magic strings
- Rename Props to BpkPriceRangeProps
- Export MARKER_DISPLAY_TYPES and MarkerDisplayType from package
- Update tests, examples, and documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Jack-Waller Jack Waller (Jack-Waller) changed the title [LUNA-3186]: Make marker prop optional in BpkPriceRange (Breaking Changes) feat(BpkPriceRange)!: simplify API with MARKER_DISPLAY_TYPES Jan 22, 2026
@Jack-Waller Jack Waller (Jack-Waller) marked this pull request as ready for review January 22, 2026 19:34
@skyscanner-backpack-bot

This comment was marked as outdated.

@Jack-Waller Jack Waller (Jack-Waller) changed the title feat(BpkPriceRange)!: simplify API with MARKER_DISPLAY_TYPES [LUNA-3186]: Make marker prop optional in BpkPriceRange (breaking change option) Jan 22, 2026
@gert-janvercauteren

Hi Jack Waller (@Jack-Waller), have you tried to generate a codemod for this breaking change? If we could just run a script for our consumers it's not that big of a breaking change I reckon. Especially since usages are relatively low.

@Jack-Waller Jack Waller (Jack-Waller) marked this pull request as draft January 23, 2026 14:41
@Jack-Waller
Copy link
Member Author

Hi Jack Waller (Jack Waller (@Jack-Waller)), have you tried to generate a codemod for this breaking change? If we could just run a script for our consumers it's not that big of a breaking change I reckon. Especially since usages are relatively low.

Hi Gert-Jan Vercauteren (@gert-janvercauteren), great suggestion! We're evaluating weather we want to proceed with this PR now: I think a codemod should be straightforward for this change if we do 🙂 I'm in the process of writing a decision document for this change if you're interested (still WIP).

- Add unit test for bubble marker rendering when type is omitted
- Add accessibility test for default marker type scenario
- Add example demonstrating default type behaviour
- Update README to document type as optional with BUBBLE default

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Jack-Waller Jack Waller (Jack-Waller) marked this pull request as ready for review January 26, 2026 14:22
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4133 to see this build running in a browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants