IceCubesApp/Packages/DesignSystem/Sources/DesignSystem/Views/ErrorView.swift
Thomas 980b9a5dd6
Implement Localization (#80)
* Implement localization

* Fix some localization keys

* Adapt to recent changes
2023-01-19 18:14:08 +01:00

41 lines
1.1 KiB
Swift

import SwiftUI
public struct ErrorView: View {
public let title: LocalizedStringKey
public let message: LocalizedStringKey
public let buttonTitle: LocalizedStringKey
public let onButtonPress: () -> Void
public init(title: LocalizedStringKey, message: LocalizedStringKey, buttonTitle: LocalizedStringKey, onButtonPress: @escaping (() -> Void)) {
self.title = title
self.message = message
self.buttonTitle = buttonTitle
self.onButtonPress = onButtonPress
}
public var body: some View {
VStack {
Image(systemName: "exclamationmark.triangle.fill")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxHeight: 50)
Text(title)
.font(.scaledTitle)
.padding(.top, 16)
Text(message)
.font(.scaledSubheadline)
.multilineTextAlignment(.center)
.foregroundColor(.gray)
Button {
onButtonPress()
} label: {
Text(buttonTitle)
}
.buttonStyle(.bordered)
.padding(.top, 16)
}
.padding(.top, 100)
.padding(.layoutPadding)
}
}