comparison GeoQuiz/Helpers/SettingsRow.swift @ 30:eb23effeede7

add DatasetView
author Dennis C. M. <dennis@denniscm.com>
date Thu, 10 Nov 2022 11:51:52 +0100
parents 3f4b366d476d
children
comparison
equal deleted inserted replaced
29:f5a2c2dab208 30:eb23effeede7
9 9
10 struct SettingsRow: View { 10 struct SettingsRow: View {
11 var color: Color 11 var color: Color
12 var symbol: String 12 var symbol: String
13 var text: String 13 var text: String
14 var url: URL
15 14
16 @Environment(\.openURL) var openURL
17 15
18 var body: some View { 16 var body: some View {
19 Link(destination: url) { 17 HStack(alignment: .center, spacing: 20) {
20 HStack(alignment: .center, spacing: 20) { 18 RoundedRectangle(cornerRadius: 5)
21 RoundedRectangle(cornerRadius: 5) 19 .frame(width: 30, height: 30)
22 .frame(width: 30, height: 30) 20 .foregroundColor(color)
23 .foregroundColor(color) 21 .overlay(
24 .overlay( 22 Image(systemName: symbol)
25 Image(systemName: symbol) 23 .foregroundColor(.white)
26 .foregroundColor(.white) 24 )
27 ) 25
28 26 Text(text)
29 Text(text) 27 .foregroundColor(.primary)
30 .foregroundColor(.primary)
31 }
32 } 28 }
29
33 } 30 }
34 } 31 }
35 32
36 struct SettingsRow_Previews: PreviewProvider { 33 struct SettingsRow_Previews: PreviewProvider {
37 static var previews: some View { 34 static var previews: some View {
38 SettingsRow( 35 SettingsRow(
39 color: .mayaBlue, 36 color: .mayaBlue,
40 symbol: "info", 37 symbol: "info",
41 text: "About", 38 text: "About"
42 url: URL(string: "https://dennistech.io")!
43 ) 39 )
44 } 40 }
45 } 41 }