Mercurial > public > geoquiz
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/GeoQuiz/Helpers/LinkComponent.swift Fri Oct 07 18:50:38 2022 +0200 @@ -0,0 +1,41 @@ +// +// LinkComponent.swift +// GeoQuiz +// +// Created by Dennis Concepción Martín on 7/10/22. +// + +import SwiftUI + +struct LinkComponent: View { + var color: Color + var iconName: String + var text: String + var url: URL + + @Environment(\.openURL) var openURL + + var body: some View { + Link(destination: url) { + HStack(alignment: .center, spacing: 20) { + Image(systemName: iconName) + .imageScale(.large) + .foregroundColor(color) + + Text(text) + .foregroundColor(.primary) + } + } + } +} + +struct LinkComponent_Previews: PreviewProvider { + static var previews: some View { + LinkComponent( + color: .mayaBlue, + iconName: "info.circle.fill", + text: "About", + url: URL(string: "https://dennistech.io")! + ) + } +}