Impressia/Vernissage/Widgets/LabelIcon.swift

33 lines
755 B
Swift
Raw Normal View History

2022-12-29 17:27:15 +01:00
//
// https://mczachurski.dev
// Copyright © 2022 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
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-01-08 14:50:37 +01:00
if let value {
HStack(alignment: .center) {
Image(systemName: iconName)
.frame(width: 30, alignment: .leading)
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
}
}