40 lines
1020 B
Swift
40 lines
1020 B
Swift
import SwiftUI
|
|
|
|
struct AuthNavigationBar: View {
|
|
let title: String?
|
|
let onBack: () -> Void
|
|
|
|
init(title: String? = nil, onBack: @escaping () -> Void) {
|
|
self.title = title
|
|
self.onBack = onBack
|
|
}
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Button(action: onBack) {
|
|
Image(systemName: "chevron.left")
|
|
.font(.system(size: 18, weight: .semibold))
|
|
.foregroundStyle(.white)
|
|
.frame(width: 44, height: 44)
|
|
.contentShape(Rectangle())
|
|
}
|
|
.accessibilityLabel("Back")
|
|
|
|
if let title {
|
|
Text(title)
|
|
.font(.system(size: 18, weight: .semibold))
|
|
.foregroundStyle(.white)
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
.padding(.horizontal, 8)
|
|
.padding(.vertical, 4)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
AuthNavigationBar(title: "Set Password", onBack: {})
|
|
.background(RosettaColors.authBackground)
|
|
}
|