diff GeoQuiz/Helpers/AnswerButton.swift @ 0:413e2d21333e

first commit
author Dennis C. M. <dennis@denniscm.com>
date Tue, 20 Sep 2022 08:13:26 +0200
parents
children 1946bbfde4af
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GeoQuiz/Helpers/AnswerButton.swift	Tue Sep 20 08:13:26 2022 +0200
@@ -0,0 +1,39 @@
+//
+//  AnswerButton.swift
+//  GeoQuiz
+//
+//  Created by Dennis Concepción Martín on 14/9/22.
+//
+
+import SwiftUI
+
+struct AnswerButton: View {
+    let optionName: String
+    let color: Color
+    
+    var body: some View {
+        RoundedRectangle(cornerRadius: 15)
+            .foregroundStyle(.regularMaterial)
+            .overlay(
+                Text(optionName)
+                    .font(.title2.bold())
+                    .foregroundColor(color)
+            )
+    }
+}
+
+struct AnswerButton_Previews: PreviewProvider {
+    static var previews: some View {
+        ZStack {
+            LinearGradient(gradient: .main, startPoint: .top, endPoint: .bottom)
+                .ignoresSafeArea()
+            
+            VStack {
+                Spacer()
+                AnswerButton(optionName: "Madrid", color: .royalLightBlue)
+                    .frame(height: 70)
+            }
+            .padding()
+        }
+    }
+}