[lcenavigationview-adoption] Adopt LCENavigationView across 15 screens
Standardizes the back button to a single shared component (AppBackButtonIcon, 32x32/14pt) instead of ~16 hand-duplicated 52x52/24pt copies, and wires each screen through LCENavigationView per this project's mandatory-usage rule. Home and Store Detail intentionally excluded - both have bespoke header designs (collapsing header, hero-image overlay) this change would visually disrupt.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import SwiftUI
|
||||
import WebKit
|
||||
#if canImport(LCEssentials)
|
||||
import LCEssentials
|
||||
#endif
|
||||
|
||||
private struct RemotePDFView: View {
|
||||
let url: URL
|
||||
@@ -69,52 +72,32 @@ private struct LegalDocumentScreen: View {
|
||||
@State private var hasError = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
screenHeader
|
||||
LCENavigationView {
|
||||
content
|
||||
}
|
||||
.setLeftButton(image: AnyView(AppBackButtonIcon())) { dismiss() }
|
||||
.setTitle(text: Text(headerTitle).font(AppTypography.heading2).foregroundStyle(AppColors.textPrimary))
|
||||
}
|
||||
|
||||
private var content: some View {
|
||||
ZStack {
|
||||
RemotePDFView(url: document.url, isLoading: $isLoading, hasError: $hasError)
|
||||
|
||||
if isLoading {
|
||||
ProgressView()
|
||||
}
|
||||
|
||||
if hasError {
|
||||
VStack(spacing: 8) {
|
||||
Text("Não foi possível carregar \(title.lowercased()).")
|
||||
.font(AppTypography.body)
|
||||
.foregroundStyle(AppColors.textPrimary)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.padding(24)
|
||||
|
||||
ZStack {
|
||||
RemotePDFView(url: document.url, isLoading: $isLoading, hasError: $hasError)
|
||||
|
||||
if isLoading {
|
||||
ProgressView()
|
||||
}
|
||||
|
||||
if hasError {
|
||||
VStack(spacing: 8) {
|
||||
Text("Não foi possível carregar \(title.lowercased()).")
|
||||
.font(AppTypography.body)
|
||||
.foregroundStyle(AppColors.textPrimary)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.padding(24)
|
||||
}
|
||||
}
|
||||
}
|
||||
.background((colorScheme == .dark ? Color.black : AppColors.backgroundLight).ignoresSafeArea())
|
||||
.appHiddenNavigationBar()
|
||||
.navigationBarBackButtonHidden(true)
|
||||
}
|
||||
|
||||
private var screenHeader: some View {
|
||||
ZStack {
|
||||
Text(headerTitle)
|
||||
.font(AppTypography.heading2)
|
||||
.foregroundStyle(AppColors.textPrimary)
|
||||
HStack {
|
||||
Button(action: { dismiss() }) {
|
||||
Image(systemName: "chevron.left")
|
||||
.font(.system(size: 24, weight: .semibold))
|
||||
.foregroundStyle(AppColors.textPrimary)
|
||||
.frame(width: 52, height: 52)
|
||||
.background(AppColors.surface)
|
||||
.clipShape(Circle())
|
||||
.shadow(color: .black.opacity(0.06), radius: 8, y: 2)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user