Mercurial > public > geoquiz
annotate GeoQuiz/Components/LinkHelper.swift @ 15:f1967f8cc67b
first iteration of core data
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 19 Oct 2022 10:04:17 +0200 |
parents | a793f33f05fb |
children | f140bb277c96 |
rev | line source |
---|---|
9 | 1 // |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
9
diff
changeset
|
2 // LinkHelper.swift |
9 | 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 } |