2023-02-01 18:40:28 +01:00
|
|
|
//
|
|
|
|
// https://mczachurski.dev
|
|
|
|
// Copyright © 2023 Marcin Czachurski and the repository contributors.
|
2023-03-28 10:35:38 +02:00
|
|
|
// Licensed under the Apache License 2.0.
|
2023-02-01 18:40:28 +01:00
|
|
|
//
|
2023-04-01 12:10:59 +02:00
|
|
|
|
2023-02-01 18:40:28 +01:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct NoDataView: View {
|
2023-04-01 12:10:59 +02:00
|
|
|
|
2023-02-01 18:40:28 +01:00
|
|
|
private let imageSystemName: String
|
2023-03-13 13:53:36 +01:00
|
|
|
private let text: LocalizedStringKey
|
2023-04-01 12:10:59 +02:00
|
|
|
|
2023-03-13 13:53:36 +01:00
|
|
|
init(imageSystemName: String, text: LocalizedStringKey) {
|
2023-02-01 18:40:28 +01:00
|
|
|
self.imageSystemName = imageSystemName
|
|
|
|
self.text = text
|
|
|
|
}
|
2023-04-01 12:10:59 +02:00
|
|
|
|
2023-02-01 18:40:28 +01:00
|
|
|
var body: some View {
|
|
|
|
VStack {
|
|
|
|
Image(systemName: self.imageSystemName)
|
|
|
|
.font(.largeTitle)
|
|
|
|
.padding(.bottom, 4)
|
2023-03-13 13:53:36 +01:00
|
|
|
Text(self.text, comment: "No data message")
|
2023-02-01 18:40:28 +01:00
|
|
|
.font(.title3)
|
|
|
|
}
|
|
|
|
.foregroundColor(.lightGrayColor)
|
|
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
|
|
|
|
}
|
|
|
|
}
|