Mercurial > public > geoquiz
annotate GeoQuiz/Helpers/AnswerButton.swift @ 33:6d574bd1644f
refactor controllers
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sat, 12 Nov 2022 11:18:30 +0100 |
parents | 425078c01194 |
children |
rev | line source |
---|---|
0 | 1 // |
20 | 2 // AnswerButton.swift |
0 | 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 { | |
19 | 11 let name: String |
0 | 12 let color: Color |
13 | |
14 var body: some View { | |
15 RoundedRectangle(cornerRadius: 15) | |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
16 .foregroundColor(.white) |
0 | 17 .overlay( |
19 | 18 Text(name) |
0 | 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() | |
19 | 33 AnswerButton(name: "Madrid", color: .royalLightBlue) |
0 | 34 .frame(height: 70) |
35 } | |
36 .padding() | |
37 } | |
38 } | |
39 } |