comparison GeoQuiz/Helpers/GameButton.swift @ 0:413e2d21333e

first commit
author Dennis C. M. <dennis@denniscm.com>
date Tue, 20 Sep 2022 08:13:26 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:413e2d21333e
1 //
2 // GameButton.swift
3 // GeoQuiz
4 //
5 // Created by Dennis Concepción Martín on 5/9/22.
6 //
7
8 import SwiftUI
9
10 struct GameButton: View {
11 let gradient: Gradient
12 let level: String
13 let symbol: String
14 let name: String
15
16 var body: some View {
17 ZStack {
18 RoundedRectangle(cornerRadius: 20)
19 .fill(
20 LinearGradient(
21 gradient: gradient,
22 startPoint: .trailing, endPoint: .leading
23 )
24 )
25 .frame(height: 180)
26
27 VStack(alignment: .leading) {
28 HStack {
29 Image(systemName: symbol)
30 .font(.headline)
31 .padding(5)
32 .background(
33 RoundedRectangle(cornerRadius: 5)
34 .stroke(lineWidth: 1.5)
35 )
36
37 Spacer()
38 }
39 .padding(.bottom)
40
41 VStack(alignment: .leading, spacing: 5) {
42 Text(level)
43 .font(.callout)
44
45 Text(name)
46 .font(.title.bold())
47 }
48 }
49 .foregroundColor(.white)
50 .padding()
51 }
52 }
53 }
54
55 struct PlayButton_Previews: PreviewProvider {
56 static var previews: some View {
57 GameButton(
58 gradient: Gradient(colors: [Color("MainDark"), Color("Main")]),
59 level: "Level 1",
60 symbol: "checkmark",
61 name: "Guess the flag"
62 )
63 }
64 }