Mercurial > public > geoquiz
comparison GeoQuiz/Helpers/AnswerButton.swift @ 26:425078c01194
refactor code
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 09 Nov 2022 10:30:01 +0100 |
parents | GeoQuiz/Components/AnswerButton.swift@e281791e0494 |
children |
comparison
equal
deleted
inserted
replaced
25:b3df0f5dc750 | 26:425078c01194 |
---|---|
1 // | |
2 // AnswerButton.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 name: String | |
12 let color: Color | |
13 | |
14 var body: some View { | |
15 RoundedRectangle(cornerRadius: 15) | |
16 .foregroundColor(.white) | |
17 .overlay( | |
18 Text(name) | |
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(name: "Madrid", color: .royalLightBlue) | |
34 .frame(height: 70) | |
35 } | |
36 .padding() | |
37 } | |
38 } | |
39 } |