Add links for email, phone and domain

This commit is contained in:
Christoph Hagen
2023-11-10 11:22:49 +01:00
parent 43a1789332
commit b0f2bdf430
6 changed files with 82 additions and 15 deletions

View File

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