CHResume/ResumeBuilder/Generic Elements/LeftImageLabel.swift
2023-11-10 11:22:49 +01:00

29 lines
671 B
Swift

import SwiftUI
import SFSafeSymbols
struct LeftImageLabel<Content>: View where Content: View {
let systemSymbol: SFSymbol
let content: Content
init(systemSymbol: SFSymbol, @ViewBuilder content: () -> Content) {
self.systemSymbol = systemSymbol
self.content = content()
}
var body: some View {
HStack(alignment: .center, spacing: 0) {
content
Image(systemSymbol: systemSymbol)
.frame(width: 20)
}
}
}
struct LeftImageLabel_Previews: PreviewProvider {
static var previews: some View {
LeftImageLabel(systemSymbol: .house) { Text("Home address") }
}
}