Skip to content

Commit 87a46da

Browse files
committed
update subnavigation headers to align with parent and sidebar
1 parent df81a6f commit 87a46da

File tree

1 file changed

+36
-53
lines changed

1 file changed

+36
-53
lines changed

WooCommerce/Classes/POS/Presentation/Settings/PointOfSaleSettingsHardwareDetailView.swift

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,14 @@ struct PointOfSaleSettingsHardwareDetailView: View {
8282
}
8383

8484
private var cardReadersView: some View {
85-
VStack(spacing: POSSpacing.large) {
85+
VStack(spacing: POSSpacing.none) {
86+
POSPageHeaderView(
87+
title: Localization.cardReadersTitle,
88+
backButtonConfiguration: .init(state: .enabled, action: {
89+
navigationPath.removeLast()
90+
}, buttonIcon: "chevron.left"))
91+
.foregroundColor(.posSurface)
92+
8693
List {
8794
VStack(spacing: POSPadding.xSmall) {
8895
HStack {
@@ -131,71 +138,47 @@ struct PointOfSaleSettingsHardwareDetailView: View {
131138
.foregroundColor(.posOnSurface)
132139
}
133140
.navigationBarBackButtonHidden(true)
134-
.toolbar {
135-
ToolbarItem(placement: .navigationBarLeading) {
136-
Button {
137-
navigationPath.removeLast()
138-
} label: {
139-
HStack(spacing: POSSpacing.small) {
140-
Image(systemName: "chevron.left")
141-
Text(Localization.cardReadersTitle)
142-
}
143-
.font(.posBodyLargeRegular())
144-
.foregroundColor(.posOnSurface)
145-
.contentShape(Rectangle())
146-
}
147-
}
148-
}
149-
.toolbarBackground(backgroundColor, for: .navigationBar)
150141
.posFullScreenCover(isPresented: $showCardReaderDocumentationModal) {
151142
SafariView(url: WooConstants.URLs.inPersonPaymentsLearnMoreWCPay.asURL())
152143
}
153144
}
154145

155146
private var scannersView: some View {
156-
List(ScannerDestination.allCases) { destination in
157-
Button {
158-
handleScannerDestination(destination)
159-
} label: {
160-
HStack(alignment: .firstTextBaseline) {
161-
Image(systemName: destination.icon)
162-
.font(.posBodyLargeRegular())
163-
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
164-
Text(destination.title)
165-
.font(.posBodyLargeRegular())
166-
Text(destination.subtitle)
167-
.font(.posBodyMediumRegular())
168-
.foregroundStyle(.secondary)
169-
}
170-
}
171-
}
172-
.buttonStyle(.plain)
173-
.listRowSeparator(.hidden)
174-
}
175-
.listStyle(.plain)
176-
.scrollContentBackground(.hidden)
177-
.listRowBackground(Color.clear)
178-
.background(backgroundColor)
179-
.foregroundColor(.posOnSurface)
180-
.navigationBarBackButtonHidden(true)
181-
.toolbar {
182-
ToolbarItem(placement: .navigationBarLeading) {
183-
Button {
147+
VStack(spacing: POSSpacing.none) {
148+
POSPageHeaderView(
149+
title: Localization.scannersTitle,
150+
backButtonConfiguration: .init(state: .enabled, action: {
184151
navigationPath.removeLast()
152+
}, buttonIcon: "chevron.left"))
153+
.foregroundColor(.posSurface)
154+
155+
List(ScannerDestination.allCases) { destination in
156+
Button {
157+
handleScannerDestination(destination)
185158
} label: {
186-
HStack(spacing: POSSpacing.small) {
187-
Image(systemName: "chevron.left")
188-
Text(Localization.scannersTitle)
159+
HStack(alignment: .firstTextBaseline) {
160+
Image(systemName: destination.icon)
161+
.font(.posBodyLargeRegular())
162+
VStack(alignment: .leading, spacing: POSPadding.xSmall) {
163+
Text(destination.title)
164+
.font(.posBodyLargeRegular())
165+
Text(destination.subtitle)
166+
.font(.posBodyMediumRegular())
167+
.foregroundStyle(.secondary)
168+
}
189169
}
190-
.font(.posBodyLargeRegular())
191-
.foregroundColor(.posOnSurface)
192-
.contentShape(Rectangle())
193170
}
171+
.buttonStyle(.plain)
172+
.listRowSeparator(.hidden)
194173
}
174+
.listStyle(.plain)
175+
.scrollContentBackground(.hidden)
176+
.listRowBackground(Color.clear)
177+
.background(backgroundColor)
178+
.foregroundColor(.posOnSurface)
195179
}
196-
.toolbarBackground(backgroundColor, for: .navigationBar)
180+
.navigationBarBackButtonHidden(true)
197181
}
198-
199182
}
200183

201184
extension PointOfSaleSettingsHardwareDetailView {

0 commit comments

Comments
 (0)