Skip to content

Commit aea0faf

Browse files
committed
Use DynamicHStack for cart trailing content.
1 parent 0ad942c commit aea0faf

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

WooCommerce/Classes/POS/Presentation/CartView.swift

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,24 @@ struct CartView: View {
2121
POSPageHeaderView(title: Localization.cartTitle,
2222
backButtonConfiguration: backButtonConfiguration,
2323
trailingContent: {
24-
if let itemsInCartLabel = viewHelper.itemsInCartLabel(for: posModel.cart.count) {
25-
Text(itemsInCartLabel)
26-
.font(Constants.itemsFont)
27-
.lineLimit(1)
28-
.minimumScaleFactor(0.5)
29-
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
30-
.foregroundColor(Color.posOnSurfaceVariantLowest)
31-
}
24+
DynamicHStack(horizontalAlignment: .trailing, verticalAlignment: .center, spacing: Constants.cartHeaderElementSpacing) {
25+
if let itemsInCartLabel = viewHelper.itemsInCartLabel(for: posModel.cart.count) {
26+
Text(itemsInCartLabel)
27+
.font(Constants.itemsFont)
28+
.lineLimit(1)
29+
.minimumScaleFactor(0.5)
30+
.dynamicTypeSize(...DynamicTypeSize.accessibility2)
31+
.foregroundColor(Color.posOnSurfaceVariantLowest)
32+
}
3233

33-
Button {
34-
posModel.removeAllItemsFromCart()
35-
} label: {
36-
Text(Localization.clearButtonTitle)
34+
Button {
35+
posModel.removeAllItemsFromCart()
36+
} label: {
37+
Text(Localization.clearButtonTitle)
38+
}
39+
.buttonStyle(POSOutlinedButtonStyle(size: .extraSmall))
40+
.renderedIf(shouldShowClearCartButton)
3741
}
38-
.buttonStyle(POSOutlinedButtonStyle(size: .extraSmall))
39-
.renderedIf(shouldShowClearCartButton)
4042
})
4143
.if(shouldApplyHeaderBottomShadow, transform: { $0.applyBottomShadow(backgroundColor: backgroundColor) })
4244

0 commit comments

Comments
 (0)