comparison GeoQuiz/Components/AnswerButtonHelper.swift @ 10:a793f33f05fb

refactor code and fix layout
author Dennis C. M. <dennis@denniscm.com>
date Sat, 08 Oct 2022 21:36:40 +0200
parents GeoQuiz/Helpers/AnswerButton.swift@e09959b4e4a8
children f140bb277c96
comparison
equal deleted inserted replaced
9:3540c7efc216 10:a793f33f05fb
1 //
2 // AnswerButtonHelper.swift
3 // GeoQuiz
4 //
5 // Created by Dennis Concepción Martín on 14/9/22.
6 //
7
8 import SwiftUI
9
10 struct AnswerButton: View {
11 let optionName: String
12 let color: Color
13
14 var body: some View {
15 RoundedRectangle(cornerRadius: 15)
16 .foregroundColor(.white)
17 .overlay(
18 Text(optionName)
19 .font(.title2.bold())
20 .foregroundColor(color)
21 )
22 }
23 }
24
25 struct AnswerButton_Previews: PreviewProvider {
26 static var previews: some View {
27 ZStack {
28 LinearGradient(gradient: .main, startPoint: .top, endPoint: .bottom)
29 .ignoresSafeArea()
30
31 VStack {
32 Spacer()
33 AnswerButton(optionName: "Madrid", color: .royalLightBlue)
34 .frame(height: 70)
35 }
36 .padding()
37 }
38 }
39 }