view GeoQuiz/Helpers/SettingsRow.swift @ 27:3f4b366d476d

add flag layout settings
author Dennis C. M. <dennis@denniscm.com>
date Thu, 10 Nov 2022 09:26:48 +0100
parents GeoQuiz/Helpers/FormLink.swift@425078c01194
children eb23effeede7
line wrap: on
line source

//
//  SettingsRow.swift
//  GeoQuiz
//
//  Created by Dennis Concepción Martín on 7/10/22.
//

import SwiftUI

struct SettingsRow: View {
    var color: Color
    var symbol: String
    var text: String
    var url: URL
    
    @Environment(\.openURL) var openURL
    
    var body: some View {
        Link(destination: url) {
            HStack(alignment: .center, spacing: 20) {
                RoundedRectangle(cornerRadius: 5)
                    .frame(width: 30, height: 30)
                    .foregroundColor(color)
                    .overlay(
                        Image(systemName: symbol)
                            .foregroundColor(.white)
                    )
                
                Text(text)
                    .foregroundColor(.primary)
            }
        }
    }
}

struct SettingsRow_Previews: PreviewProvider {
    static var previews: some View {
        SettingsRow(
            color: .mayaBlue,
            symbol: "info",
            text: "About",
            url: URL(string: "https://dennistech.io")!
        )
    }
}