Skip to content

Commit 5fbd0bd

Browse files
committed
Add SelectionStyle to TitleAndValueRow
1 parent 98e6dcd commit 5fbd0bd

File tree

11 files changed

+55
-31
lines changed

11 files changed

+55
-31
lines changed

WooCommerce/Classes/View Modifiers/WooStyleModifiers.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ struct LinkStyle: ViewModifier {
101101
}
102102
}
103103

104+
struct HeadlineLinkStyle: ViewModifier {
105+
func body(content: Content) -> some View {
106+
content
107+
.font(.headline)
108+
.foregroundColor(Color(.accent))
109+
}
110+
}
111+
104112
// MARK: View extensions
105113
extension View {
106114
/// - Parameters:
@@ -143,4 +151,8 @@ extension View {
143151
func linkStyle() -> some View {
144152
self.modifier(LinkStyle())
145153
}
154+
155+
func headlineLinkStyle() -> some View {
156+
self.modifier(HeadlineLinkStyle())
157+
}
146158
}

WooCommerce/Classes/ViewRelated/Coupons/CouponDetails/CouponDetails.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct CouponDetails: View {
112112
ForEach(detailRows) { row in
113113
TitleAndValueRow(title: row.title,
114114
value: .content(row.content),
115-
selectable: true,
115+
selectionStyle: .disclosure,
116116
action: row.action)
117117
.padding(.vertical, Constants.verticalSpacing)
118118
.padding(.horizontal, insets: geometry.safeAreaInsets)

WooCommerce/Classes/ViewRelated/Orders/Order Creation/PaymentSection/OrderPaymentSection.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ struct OrderPaymentSection: View {
2222
.headlineStyle()
2323
.padding()
2424

25-
TitleAndValueRow(title: Localization.productsTotal, value: .content(viewModel.itemsTotal), selectable: false) {}
25+
TitleAndValueRow(title: Localization.productsTotal, value: .content(viewModel.itemsTotal), selectionStyle: .none) {}
2626

2727
if viewModel.shouldShowShippingTotal {
28-
TitleAndValueRow(title: Localization.shippingTotal, value: .content(viewModel.shippingTotal), selectable: true) {
28+
TitleAndValueRow(title: Localization.shippingTotal, value: .content(viewModel.shippingTotal), selectionStyle: .highlight) {
2929
saveShippingLineClosure(nil)
3030
}
3131
} else {
@@ -42,7 +42,7 @@ struct OrderPaymentSection: View {
4242
.padding()
4343
}
4444

45-
TitleAndValueRow(title: Localization.orderTotal, value: .content(viewModel.orderTotal), bold: true, selectable: false) {}
45+
TitleAndValueRow(title: Localization.orderTotal, value: .content(viewModel.orderTotal), bold: true, selectionStyle: .none) {}
4646

4747
Text(Localization.taxesInfo)
4848
.footnoteStyle()

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/EditOrderAddressForm.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ struct SingleAddressForm: View {
302302

303303
TitleAndValueRow(title: Localization.countryField,
304304
value: .init(placeHolder: Localization.placeholderSelectOption, content: fields.country),
305-
selectable: true) {
305+
selectionStyle: .disclosure) {
306306
showCountrySelector = true
307307
}
308308
Divider()
@@ -321,7 +321,7 @@ struct SingleAddressForm: View {
321321
if showStateFieldAsSelector {
322322
TitleAndValueRow(title: Localization.stateField,
323323
value: .init(placeHolder: Localization.placeholderSelectOption, content: fields.state),
324-
selectable: true) {
324+
selectionStyle: .disclosure) {
325325
showStateSelector = true
326326
}
327327
} else {

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/Customs/ItemDetails/ShippingLabelCustomsFormItemDetails.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct ShippingLabelCustomsFormItemDetails: View {
125125
// Origin country
126126
VStack(spacing: 0) {
127127
VStack(spacing: 0) {
128-
TitleAndValueRow(title: Localization.originTitle, value: .placeholder(viewModel.originCountry.name), selectable: true) {
128+
TitleAndValueRow(title: Localization.originTitle, value: .placeholder(viewModel.originCountry.name), selectionStyle: .disclosure) {
129129
isShowingCountries.toggle()
130130
}
131131
.sheet(isPresented: $isShowingCountries, content: {

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/Customs/ShippingLabelCustomsFormInput.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct ShippingLabelCustomsFormInput: View {
6666

6767
private var contentRows: some View {
6868
VStack(spacing: 0) {
69-
TitleAndValueRow(title: Localization.contentTypeTitle, value: .placeholder(viewModel.contentsType.localizedName), selectable: true) {
69+
TitleAndValueRow(title: Localization.contentTypeTitle, value: .placeholder(viewModel.contentsType.localizedName), selectionStyle: .disclosure) {
7070
showingContentTypes.toggle()
7171
}
7272
.sheet(isPresented: $showingContentTypes, content: {
@@ -99,7 +99,9 @@ struct ShippingLabelCustomsFormInput: View {
9999

100100
private var restrictionRows: some View {
101101
VStack(spacing: 0) {
102-
TitleAndValueRow(title: Localization.restrictionTypeTitle, value: .placeholder(viewModel.restrictionType.localizedName), selectable: true) {
102+
TitleAndValueRow(title: Localization.restrictionTypeTitle,
103+
value: .placeholder(viewModel.restrictionType.localizedName),
104+
selectionStyle: .disclosure) {
103105
showingRestrictionTypes.toggle()
104106
}
105107
.sheet(isPresented: $showingRestrictionTypes, content: {

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/Package Details/Multi-package/ShippingLabelSinglePackage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct ShippingLabelSinglePackage: View {
4242
VStack(spacing: 0) {
4343
Divider()
4444

45-
TitleAndValueRow(title: Localization.packageSelected, value: .placeholder(viewModel.selectedPackageName), selectable: true) {
45+
TitleAndValueRow(title: Localization.packageSelected, value: .placeholder(viewModel.selectedPackageName), selectionStyle: .disclosure) {
4646
isShowingPackageSelection.toggle()
4747
}
4848
.padding(.horizontal, insets: safeAreaInsets)

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/Package Details/Package Selection/Package Creation/ShippingLabelCustomPackageForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct ShippingLabelCustomPackageForm: View {
2020
// Package type
2121
TitleAndValueRow(title: Localization.packageTypeLabel,
2222
value: .placeholder(viewModel.packageType.localizedName),
23-
selectable: true) {
23+
selectionStyle: .disclosure) {
2424
showingPackageTypes.toggle()
2525
}
2626
.sheet(isPresented: $showingPackageTypes, content: {

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/Create Shipping Label Form/Package Details/ShippingLabelPackageDetails.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct ShippingLabelPackageDetails: View {
4545
VStack(spacing: 0) {
4646
Divider()
4747

48-
TitleAndValueRow(title: Localization.packageSelected, value: .placeholder(viewModel.selectedPackageName), selectable: true) {
48+
TitleAndValueRow(title: Localization.packageSelected, value: .placeholder(viewModel.selectedPackageName), selectionStyle: .disclosure) {
4949
showingPackageSelection.toggle()
5050
}
5151
.padding(.horizontal, insets: geometry.safeAreaInsets)

WooCommerce/Classes/ViewRelated/Orders/Simple Payments/Summary/SimplePaymentsSummary.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private struct PaymentsSection: View {
166166
.headlineStyle()
167167
.padding([.horizontal, .top])
168168

169-
TitleAndValueRow(title: SimplePaymentsSummary.Localization.subtotal, value: .content(viewModel.providedAmount), selectable: false) {}
169+
TitleAndValueRow(title: SimplePaymentsSummary.Localization.subtotal, value: .content(viewModel.providedAmount), selectionStyle: .none) {}
170170

171171
TitleAndToggleRow(title: SimplePaymentsSummary.Localization.chargeTaxes, isOn: $viewModel.enableTaxes)
172172
.padding(.horizontal)
@@ -181,17 +181,17 @@ private struct PaymentsSection: View {
181181
ForEach(viewModel.taxLines) { taxLine in
182182
TitleAndValueRow(title: taxLine.title,
183183
value: .content(taxLine.value),
184-
selectable: false) {}
184+
selectionStyle: .none) {}
185185
}
186186
} else {
187187
TitleAndValueRow(title: SimplePaymentsSummary.Localization.taxRate(viewModel.taxRate),
188188
value: .content(viewModel.taxAmount),
189-
selectable: false) {}
189+
selectionStyle: .none) {}
190190
}
191191
}
192192
.renderedIf(viewModel.enableTaxes)
193193

194-
TitleAndValueRow(title: SimplePaymentsSummary.Localization.total, value: .content(viewModel.total), bold: true, selectable: false) {}
194+
TitleAndValueRow(title: SimplePaymentsSummary.Localization.total, value: .content(viewModel.total), bold: true, selectionStyle: .none) {}
195195
}
196196
.padding(.horizontal, insets: safeAreaInsets)
197197
.background(Color(.listForeground))

0 commit comments

Comments
 (0)