-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameRootView.swift
More file actions
123 lines (112 loc) · 4.1 KB
/
GameRootView.swift
File metadata and controls
123 lines (112 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import SwiftUI
/// Vue racine de RettGame : menu de lancement listant les expériences de jeu
/// natives (déclinaisons des jeux GazePlay). Lien vers les réglages dans la
/// barre d'outils.
struct GameRootView: View {
@State private var showSettings = false
var body: some View {
NavigationStack {
ScrollView {
VStack(spacing: 16) {
Header()
.padding(.top, 16)
NavigationLink {
EyeGameView()
} label: {
GameCard(
title: "Tartes à la crème",
subtitle: "Vise les personnages avec ton regard pour leur envoyer une tarte 🥧.",
iconSystemName: "fork.knife.circle.fill"
)
}
.buttonStyle(.plain)
NavigationLink {
BubblesGameView()
} label: {
GameCard(
title: "Bulles colorées",
subtitle: "Fais éclater les bulles qui montent en les regardant 🫧.",
iconSystemName: "circle.hexagongrid.fill"
)
}
.buttonStyle(.plain)
}
.padding(.horizontal)
.padding(.bottom, 24)
}
.background(Color.afsrBackground.ignoresSafeArea())
.navigationTitle("RettGame")
.navigationBarTitleDisplayMode(.large)
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button {
showSettings = true
} label: {
Image(systemName: "gearshape.fill")
}
.accessibilityLabel("Réglages")
}
}
.sheet(isPresented: $showSettings) {
NavigationStack { GameSettingsView() }
}
}
}
}
private struct Header: View {
var body: some View {
VStack(spacing: 8) {
Image("RettLogo")
.resizable()
.scaledToFit()
.frame(height: 100)
Text("Choisissez une activité")
.font(AFSRFont.headline())
.foregroundStyle(.secondary)
}
}
}
private struct GameCard: View {
let title: String
let subtitle: String
let iconSystemName: String
var body: some View {
HStack(alignment: .top, spacing: 16) {
ZStack {
RoundedRectangle(cornerRadius: 18, style: .continuous)
.fill(Color.afsrPurple.opacity(0.15))
.frame(width: 64, height: 64)
Image(systemName: iconSystemName)
.font(.system(size: 28, weight: .semibold))
.foregroundStyle(Color.afsrPurpleAdaptive)
}
VStack(alignment: .leading, spacing: 6) {
Text(title)
.font(AFSRFont.headline(20))
.foregroundStyle(.primary)
Text(subtitle)
.font(AFSRFont.body(15))
.foregroundStyle(.secondary)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
}
Spacer(minLength: 0)
Image(systemName: "chevron.right")
.font(.system(size: 14, weight: .semibold))
.foregroundStyle(.tertiary)
}
.padding(16)
.background(
RoundedRectangle(cornerRadius: AFSRTokens.cornerRadius, style: .continuous)
.fill(Color(.secondarySystemBackground))
)
.overlay(
RoundedRectangle(cornerRadius: AFSRTokens.cornerRadius, style: .continuous)
.stroke(Color.afsrPurple.opacity(0.08), lineWidth: 1)
)
.shadow(color: .black.opacity(0.06), radius: 6, x: 0, y: 2)
}
}
#Preview {
GameRootView()
}