Mercurial > public > geoquiz
annotate 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 |
rev | line source |
---|---|
0 | 1 // |
10
a793f33f05fb
refactor code and fix layout
Dennis C. M. <dennis@denniscm.com>
parents:
8
diff
changeset
|
2 // AnswerButtonHelper.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 { | |
11 let optionName: String | |
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( |
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 } |