Skip to content

[SwiftUI] Update LemonadeBadge to use modifier instead of direct argument#149

Open
abiliogp wants to merge 1 commit into
mainfrom
lemonadeBadgeWithModifier
Open

[SwiftUI] Update LemonadeBadge to use modifier instead of direct argument#149
abiliogp wants to merge 1 commit into
mainfrom
lemonadeBadgeWithModifier

Conversation

@abiliogp

@abiliogp abiliogp commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Update the LemonadeBadge to use a modifier

LemonadeUi.Badge(text: "New")
          .badgeSize(.small)

It makes it more flexible to use and extend.

Figma component

https://www.figma.com/design/91S16rhVrl5wivqV66fNjm/%F0%9F%8D%8B-Lemonade-DS---New-App-Components?node-id=2201-68&p=f&t=QwYH3DuXBSAEjzV4-0

Screenshot

Screenshot 2026-04-16 at 13 36 10

Copilot AI review requested due to automatic review settings April 16, 2026 12:36
@abiliogp abiliogp requested review from a team as code owners April 16, 2026 12:36

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

Updates the SwiftUI LemonadeUi.Badge API to configure badge sizing via a view modifier (environment-driven) rather than a direct function parameter, and updates usages across components and the SampleApp accordingly.

Changes:

  • Refactors LemonadeUi.Badge to read LemonadeBadgeSize from environment and introduces a badgeSize(_:) modifier.
  • Updates component previews/usages (Tile, SymbolContainer) and SampleApp screens to the new modifier-based API.
  • Applies formatting/whitespace-only adjustments in several SwiftUI component/sample files.

Reviewed changes

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

Show a summary per file
File Description
swiftui/Sources/Lemonade/Components/LemonadeBadge.swift Introduces environment-based badge sizing + badgeSize(_:) modifier; updates Badge API and previews.
swiftui/Sources/Lemonade/Components/LemonadeTile.swift Updates Tile preview addon badge usage to new modifier API (plus whitespace).
swiftui/Sources/Lemonade/Components/LemonadeSymbolContainer.swift Updates preview badge usage to new modifier API (plus whitespace).
swiftui/SampleApp/BadgeDisplayView.swift Migrates sample badge usages to modifier API; demo sizing needs correction in a couple places.
swiftui/SampleApp/TileDisplayView.swift Migrates sample Tile addon badges to modifier API (plus whitespace).
swiftui/SampleApp/SymbolContainerDisplayView.swift Migrates sample SymbolContainer badge to modifier API (plus whitespace).
swiftui/SampleApp/ListItemDisplayView.swift Migrates trailing badge to modifier API (plus whitespace).

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

Comment thread swiftui/Sources/Lemonade/Components/LemonadeBadge.swift
Comment thread swiftui/SampleApp/BadgeDisplayView.swift Outdated
Comment thread swiftui/SampleApp/BadgeDisplayView.swift Outdated
Comment thread swiftui/SampleApp/BadgeDisplayView.swift
Comment thread swiftui/Sources/Lemonade/Components/LemonadeBadge.swift
@abiliogp abiliogp force-pushed the lemonadeBadgeWithModifier branch from ca4b667 to 3ac587b Compare April 16, 2026 12:55
@williankl williankl changed the title Update LemonadeBadge to use modifier instead of direct argument [SwiftUI] Update LemonadeBadge to use modifier instead of direct argument Apr 16, 2026
@abiliogp abiliogp force-pushed the lemonadeBadgeWithModifier branch 3 times, most recently from e50dafa to 7278866 Compare April 16, 2026 13:04

@williankl williankl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, but I am not really the best person to review this
cc @hrafaelveloso

caiqueslp
caiqueslp previously approved these changes Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants