Mercurial > public > geoquiz
comparison GeoQuiz/Components/AnswerButtonHelper.swift @ 19:f140bb277c96
refactor code
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 23 Oct 2022 00:11:38 +0100 |
parents | a793f33f05fb |
children |
comparison
equal
deleted
inserted
replaced
18:d20cf93c9812 | 19:f140bb277c96 |
---|---|
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 | 9 |
10 struct AnswerButton: View { | 10 struct AnswerButton: View { |
11 let optionName: String | 11 let name: String |
12 let color: Color | 12 let color: Color |
13 | 13 |
14 var body: some View { | 14 var body: some View { |
15 RoundedRectangle(cornerRadius: 15) | 15 RoundedRectangle(cornerRadius: 15) |
16 .foregroundColor(.white) | 16 .foregroundColor(.white) |
17 .overlay( | 17 .overlay( |
18 Text(optionName) | 18 Text(name) |
19 .font(.title2.bold()) | 19 .font(.title2.bold()) |
20 .foregroundColor(color) | 20 .foregroundColor(color) |
21 ) | 21 ) |
22 } | 22 } |
23 } | 23 } |
28 LinearGradient(gradient: .main, startPoint: .top, endPoint: .bottom) | 28 LinearGradient(gradient: .main, startPoint: .top, endPoint: .bottom) |
29 .ignoresSafeArea() | 29 .ignoresSafeArea() |
30 | 30 |
31 VStack { | 31 VStack { |
32 Spacer() | 32 Spacer() |
33 AnswerButton(optionName: "Madrid", color: .royalLightBlue) | 33 AnswerButton(name: "Madrid", color: .royalLightBlue) |
34 .frame(height: 70) | 34 .frame(height: 70) |
35 } | 35 } |
36 .padding() | 36 .padding() |
37 } | 37 } |
38 } | 38 } |