Skip to content

Commit c9f34ca

Browse files
authored
[Woo POS][Barcodes] Dark mode: corners and background when loading (#15792)
2 parents 9f6e9d5 + ce81379 commit c9f34ca

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

WooCommerce/Classes/POS/Presentation/Item Selector/GhostItemCardView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct GhostItemCardView: View {
4444
viewWidth = width
4545
}
4646
.frame(maxWidth: .infinity, idealHeight: dimension)
47-
.background(Color.posSurfaceBright)
47+
.background(configuration.backgroundColor)
4848
.posItemCardBorderStyles()
4949
}
5050

@@ -88,12 +88,14 @@ struct GhostItemCardViewConfiguration {
8888
let cardSize: CGFloat
8989
let maximumCardSize: CGFloat
9090
let placeholderWidthMultiplier: CGFloat
91+
let backgroundColor: Color
9192

9293
static let itemList = GhostItemCardViewConfiguration(
9394
placeholderHeight: 32,
9495
cardSize: Constants.productCardSize,
9596
maximumCardSize: Constants.maximumProductCardSize,
96-
placeholderWidthMultiplier: 0.5
97+
placeholderWidthMultiplier: 0.5,
98+
backgroundColor: Color.posSurfaceBright
9799
)
98100
}
99101

WooCommerce/Classes/POS/Presentation/ItemRowView.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ struct ItemRowView: View {
2323
}
2424

2525
var body: some View {
26+
itemRow
27+
.posItemCardBorderStyles()
28+
.padding(.horizontal, Constants.horizontalPadding)
29+
}
30+
31+
@ViewBuilder
32+
private var itemRow: some View {
2633
switch cartItem.state {
2734
case .loaded, .error:
2835
productRow
29-
.frame(maxWidth: .infinity, idealHeight: dimension)
30-
.background(Color.posSurfaceContainerLowest)
31-
.posItemCardBorderStyles()
32-
.padding(.horizontal, Constants.horizontalPadding)
3336
case .loading:
3437
GhostItemCardView(configuration: Constants.cartConfiguration,
3538
showProductImage: $showProductImage) {
@@ -39,8 +42,6 @@ struct ItemRowView: View {
3942
}
4043
}
4144
}
42-
.background(Color.posSurfaceContainerLowest)
43-
.padding(.horizontal, Constants.horizontalPadding)
4445
}
4546
}
4647

@@ -76,6 +77,8 @@ struct ItemRowView: View {
7677
}
7778
}
7879
.padding(.trailing, Constants.cardContentHorizontalPadding)
80+
.frame(maxWidth: .infinity, idealHeight: dimension)
81+
.background(Color.posSurfaceContainerLowest)
7982
}
8083

8184
@ViewBuilder
@@ -122,7 +125,8 @@ private extension ItemRowView {
122125
placeholderHeight: 24,
123126
cardSize: Constants.productCardSize,
124127
maximumCardSize: Constants.maximumProductCardSize,
125-
placeholderWidthMultiplier: 0.3
128+
placeholderWidthMultiplier: 0.3,
129+
backgroundColor: Color.posSurfaceContainerLowest
126130
)
127131
}
128132
}

0 commit comments

Comments
 (0)