Skip to content

Commit 2ed160f

Browse files
committed
Set minimum height to product row
When product row has no image it becomes a smaller size than a minimum required size
1 parent d0542bf commit 2ed160f

File tree

1 file changed

+79
-34
lines changed

1 file changed

+79
-34
lines changed

WooCommerce/Classes/POS/Presentation/ItemRowView.swift

Lines changed: 79 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ struct ItemRowView: View {
2626

2727
var body: some View {
2828
itemRow
29-
.background(Color.posSurfaceContainerLowest)
30-
.frame(maxWidth: .infinity, idealHeight: dynamicTypeSize.isAccessibilitySize ? nil : dimension)
31-
.posItemCardBorderStyles()
3229
.padding(.horizontal, Constants.horizontalPadding)
3330
.geometryGroup()
3431
.accessibilityLabel(accessibilityLabel)
@@ -86,6 +83,9 @@ struct ItemRowView: View {
8683
}
8784
}
8885
.padding(.trailing, Constants.cardContentHorizontalPadding)
86+
.frame(maxWidth: .infinity, minHeight: dimension, alignment: .leading)
87+
.background(Color.posSurfaceContainerLowest)
88+
.posItemCardBorderStyles()
8989
}
9090

9191
@ViewBuilder
@@ -152,39 +152,84 @@ private extension ItemRowView {
152152

153153
#if DEBUG
154154
@available(iOS 17.0, *)
155-
#Preview(traits: .sizeThatFitsLayout) {
156-
ItemRowView(cartItem: Cart.PurchasableItem(id: UUID(),
157-
item: PointOfSalePreviewItemService().providePointOfSaleItem(),
158-
title: "Item Title",
159-
subtitle: "Item Subtitle",
160-
quantity: 2),
161-
onItemRemoveTapped: { })
162-
}
155+
#Preview {
156+
ScrollView {
157+
ItemRowView(
158+
cartItem: Cart.PurchasableItem(
159+
id: UUID(),
160+
item: PointOfSalePreviewItemService().providePointOfSaleItem(),
161+
title: "Item Title",
162+
subtitle: "Item Subtitle",
163+
quantity: 2
164+
),
165+
onItemRemoveTapped: { }
166+
)
163167

164-
@available(iOS 17.0, *)
165-
#Preview(traits: .sizeThatFitsLayout) {
166-
ItemRowView(cartItem: Cart.PurchasableItem(id: UUID(),
167-
item: PointOfSalePreviewItemService().providePointOfSaleItem(),
168-
title: "Item Title",
169-
subtitle: nil,
170-
quantity: 2),
171-
onItemRemoveTapped: { })
172-
}
168+
ItemRowView(
169+
cartItem: Cart.PurchasableItem(
170+
id: UUID(),
171+
item: PointOfSalePreviewItemService().providePointOfSaleItem(),
172+
title: "Item Title With incredible long title that goes incredibly far and beyond",
173+
subtitle: "Item Subtitle",
174+
quantity: 2
175+
),
176+
onItemRemoveTapped: { }
177+
)
173178

174-
@available(iOS 17.0, *)
175-
#Preview(traits: .sizeThatFitsLayout) {
176-
ItemRowView(cartItem: Cart.PurchasableItem.loading(id: UUID()),
177-
onCancelLoading: { })
178-
}
179+
ItemRowView(
180+
cartItem: Cart.PurchasableItem(
181+
id: UUID(),
182+
item: PointOfSalePreviewItemService().providePointOfSaleItem(),
183+
title: "Item Title",
184+
subtitle: nil,
185+
quantity: 2
186+
),
187+
onItemRemoveTapped: { }
188+
)
179189

180-
@available(iOS 17.0, *)
181-
#Preview(traits: .sizeThatFitsLayout) {
182-
ItemRowView.init(cartItem: Cart.PurchasableItem(
183-
id: UUID(),
184-
title: "123-123-123",
185-
subtitle: "Unspported product type",
186-
quantity: 1,
187-
state: .error
188-
))
190+
ItemRowView(
191+
cartItem: Cart.PurchasableItem.loading(id: UUID()),
192+
onCancelLoading: { }
193+
)
194+
195+
ItemRowView(
196+
cartItem: Cart.PurchasableItem(
197+
id: UUID(),
198+
title: "123-123-123",
199+
subtitle: "Unspported product type",
200+
quantity: 1,
201+
state: .error
202+
)
203+
)
204+
205+
ItemRowView(
206+
cartItem: Cart.PurchasableItem(
207+
id: UUID(),
208+
title: "123-123-123",
209+
subtitle: "Unspported product type with an incredibly long error message that goes on and on",
210+
quantity: 1,
211+
state: .error
212+
)
213+
)
214+
215+
ItemRowView(
216+
cartItem: Cart.PurchasableItem(
217+
id: UUID(),
218+
item: PointOfSalePreviewItemService().providePointOfSaleItem(),
219+
title: "Item Title",
220+
subtitle: nil,
221+
quantity: 2
222+
),
223+
showImage: .constant(false),
224+
onItemRemoveTapped: { }
225+
)
226+
227+
ItemRowView(
228+
cartItem: Cart.PurchasableItem.loading(id: UUID()),
229+
showImage: .constant(false),
230+
onCancelLoading: { }
231+
)
232+
}
233+
.frame(width: 400)
189234
}
190235
#endif

0 commit comments

Comments
 (0)