[WASABI-11828] Update BpkPrice - #2845
Fernando Piardi (fpiardi) wants to merge 8 commits into
Conversation
Generated by 🚫 Danger Kotlin against eb78acb |
Generated by 🚫 Danger Kotlin against 2c7a9b6 |
There was a problem hiding this comment.
Warning
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.
Copilot review overview
Review effort: Lite
Findings: None
What changed in this PR
This PR extends the Compose BpkPrice component to support optional icons around leadingText and an optional click target for the leading text area, plus improves alignment for wrapped, end-aligned prices. It also updates the docs and demo to showcase the new API and multi-line wrapping behavior.
Changes:
- Add
leadingIcon,trailingIcon, andonLeadingTextClickedsupport toBpkPrice(and internal implementations). - Introduce
BpkPriceLeadingTextto render leading text with optional icons and a single accessible click target. - Improve multi-line alignment for end-aligned price/trailing text and update docs/demo examples.
| File | Description |
|---|---|
| docs/compose/Price/README.md | Adds examples for clickable leading text/icons and long wrapping prices |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/internal/BpkPriceRow.kt | Adds leading icon/click support and refactors leading text rendering |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/internal/BpkPriceLeadingText.kt | New internal composable for leading text + icons with unified click target |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/internal/BpkPriceLabel.kt | Adds optional textAlign to improve wrapping alignment for non-clickable prices |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/internal/BpkPriceImpl.kt | Wires new leading icon/click params through to alignment implementations |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/internal/BpkPriceAlignStart.kt | Adds leading icon/click support in start alignment variant |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/internal/BpkPriceAlignEnd.kt | Adds leading icon/click support and applies end textAlign for wrapped lines |
| backpack-compose/src/main/kotlin/net/skyscanner/backpack/compose/price/BpkPrice.kt | Public API extension: new params for leading icons and leading-text click |
| app/src/main/res/values/strings.xml | Adds demo strings for new examples (cheaper label, long price) |
| app/src/main/java/net/skyscanner/backpack/demo/compose/PriceStory.kt | Adds new demo scenarios and makes the story scrollable |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Generated by 🚫 Danger Kotlin against a7a9a55 |
| if (onClick != null) { | ||
| base | ||
| .clickable( | ||
| role = Role.Button, |
There was a problem hiding this comment.
Should use Modifier.clickableWithRipple(...) for consistency.
Summary
Extends BpkPrice (Compose) to support an optional icon-decorated, tappable leadingText, and fixes two pre-existing text-alignment bugs for BpkPriceAlign.End.
Figma: https://www.figma.com/design/0DqzOBrdMfjyf0wST86WrG/Price-Pulse?node-id=2451-12998&p=f&t=dDlA1obi3YLqpItX-0
New API (BpkPrice.kt)
Added three new optional parameters:
All are no-ops when leadingText is null. No changes to existing params/behavior when the new ones aren't used.
New internal component
Bug fixes
Known limitation (documented, not fixed — by design decision)
Demo (PriceStory.kt)
Docs (docs/compose/Price/README.md)
Testing notes
Remember to include the following changes:
README.mdIf you are curious about how we review, please read through the code review guidelines