comparison GeoQuiz/Helpers/LinkComponent.swift @ 9:3540c7efc216

implement UserSettings
author Dennis C. M. <dennis@denniscm.com>
date Fri, 07 Oct 2022 18:50:38 +0200
parents
children
comparison
equal deleted inserted replaced
8:e09959b4e4a8 9:3540c7efc216
1 //
2 // LinkComponent.swift
3 // GeoQuiz
4 //
5 // Created by Dennis Concepción Martín on 7/10/22.
6 //
7
8 import SwiftUI
9
10 struct LinkComponent: View {
11 var color: Color
12 var iconName: String
13 var text: String
14 var url: URL
15
16 @Environment(\.openURL) var openURL
17
18 var body: some View {
19 Link(destination: url) {
20 HStack(alignment: .center, spacing: 20) {
21 Image(systemName: iconName)
22 .imageScale(.large)
23 .foregroundColor(color)
24
25 Text(text)
26 .foregroundColor(.primary)
27 }
28 }
29 }
30 }
31
32 struct LinkComponent_Previews: PreviewProvider {
33 static var previews: some View {
34 LinkComponent(
35 color: .mayaBlue,
36 iconName: "info.circle.fill",
37 text: "About",
38 url: URL(string: "https://dennistech.io")!
39 )
40 }
41 }