2022-12-29 17:27:15 +01:00
|
|
|
//
|
|
|
|
// https://mczachurski.dev
|
|
|
|
// Copyright © 2022 Marcin Czachurski and the repository contributors.
|
2023-03-28 10:35:38 +02:00
|
|
|
// Licensed under the Apache License 2.0.
|
2022-12-29 17:27:15 +01:00
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
2023-01-03 14:09:22 +01:00
|
|
|
struct LabelIcon: View {
|
2022-12-29 17:27:15 +01:00
|
|
|
let iconName: String
|
2023-01-08 14:50:37 +01:00
|
|
|
let value: String?
|
2022-12-29 17:27:15 +01:00
|
|
|
|
|
|
|
var body: some View {
|
2023-03-08 18:28:17 +01:00
|
|
|
if let value, value.isEmpty == false {
|
2023-01-08 14:50:37 +01:00
|
|
|
HStack(alignment: .center) {
|
|
|
|
Image(systemName: iconName)
|
2023-02-19 12:18:06 +01:00
|
|
|
.frame(width: 24, alignment: .center)
|
2023-01-08 14:50:37 +01:00
|
|
|
Text(value)
|
|
|
|
.font(.footnote)
|
|
|
|
}
|
|
|
|
.padding(.vertical, 2)
|
|
|
|
} else {
|
|
|
|
EmptyView()
|
2022-12-29 17:27:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct LabelIconView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
2023-01-03 14:09:22 +01:00
|
|
|
LabelIcon(iconName: "camera", value: "Sony A7")
|
2022-12-29 17:27:15 +01:00
|
|
|
}
|
|
|
|
}
|