Skip to content

Commit 620f937

Browse files
committed
Only draw the border when needed
1 parent 91af872 commit 620f937

File tree

1 file changed

+11
-10
lines changed
  • WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components

1 file changed

+11
-10
lines changed

WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/BadgeView.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,20 @@ private extension BadgeView {
106106
case .circle:
107107
Circle()
108108
.fill(customizations.backgroundColor)
109-
.overlay(
110-
Circle()
111-
.stroke(Color.white, lineWidth: Layout.borderLineWidth)
112-
.opacity(customizations.bordered ? 1 : 0)
113-
)
109+
.if(customizations.bordered) { view in
110+
view.overlay {
111+
Circle().stroke(Color.white, lineWidth: Layout.borderLineWidth)
112+
}
113+
}
114114
case .roundedRectangle(let cornerRadius):
115115
RoundedRectangle(cornerRadius: cornerRadius)
116116
.fill(customizations.backgroundColor)
117-
.overlay(
118-
RoundedRectangle(cornerRadius: cornerRadius)
119-
.stroke(Color.white, lineWidth: Layout.borderLineWidth)
120-
.opacity(customizations.bordered ? 1 : 0)
121-
)
117+
.if(customizations.bordered) { view in
118+
view.overlay {
119+
RoundedRectangle(cornerRadius: cornerRadius)
120+
.stroke(Color.white, lineWidth: Layout.borderLineWidth)
121+
}
122+
}
122123
}
123124
}
124125
}

0 commit comments

Comments
 (0)