ParametersMenuView #14

Merged
johan.lachenal merged 4 commits from ParametersMenuView into dev 11 months ago

@ -35,7 +35,7 @@ struct DoushiQiPicker<EnumType: RawRepresentable & Identifiable & Hashable>: Vie
Text(title) Text(title)
.foregroundColor(.black) .foregroundColor(.black)
.padding() .padding()
Spacer() // .frame(width : (20 - CGFloat(title.count))) Spacer()
Text(selectedOption.rawValue.description) Text(selectedOption.rawValue.description)
.foregroundColor(.black) .foregroundColor(.black)
.padding() .padding()

@ -8,37 +8,42 @@
import SwiftUI import SwiftUI
struct MainMenu: View { struct MainMenu: View {
let playButtonText : String
let registeredGamesButtonText : String
let ParametersButtontText : String
@State private var action: Int? = 0 @State private var action: Int? = 0
@AppStorage("isDarkMode") private var isDarkMode = false @AppStorage("isDarkMode") private var isDarkMode = false
var body: some View { var body: some View {
VStack { ZStack {
NavigationView { NavigationView {
VStack(alignment: .trailing) { VStack {
HStack(alignment: .top) { Spacer()
Text("DouShiQi").frame(maxHeight: .infinity) HStack() {
.bold() Text("DouShiQi")
.font(.title) .bold()
}.frame(maxWidth: .infinity,maxHeight: .infinity) .font(.title).padding()
Spacer().frame(maxWidth: .infinity,maxHeight: .infinity) }
Spacer().frame(height: 40) Spacer().frame(height: 40)
MainMenuButton(title: "jouer") VStack(alignment: .leading) {
{ Text("jeu page") } MainMenuButton(title: playButtonText)
MainMenuButton(title: "parties enregistrées") { Text("jeu page") }
{ Text("parties enregistrées page") } Spacer().frame(height: 30)
MainMenuButton(title: "paramètres") MainMenuButton(title: registeredGamesButtonText)
{ ParametersMenuView() } { Text("parties enregistrées page") }
Spacer() Spacer().frame(height: 30)
MainMenuButton(title: ParametersButtontText)
{ ParametersMenuView() }
}
Spacer()
}
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
} }
.fixedSize(horizontal: false, vertical: true) }
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
.frame(maxWidth: .infinity,maxHeight: .infinity)
}.frame(maxWidth: .infinity,maxHeight: .infinity)
}.frame(maxWidth: .infinity,maxHeight: .infinity)
} }
} }
struct MainMenu_Previews: PreviewProvider { struct MainMenu_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
MainMenu() MainMenu(playButtonText: "Jouer", registeredGamesButtonText: "Parties enregistrées",ParametersButtontText: "Paramètres")
} }
} }

@ -17,19 +17,19 @@ struct MainMenuButton<Content : View>: View {
} }
var body: some View { var body: some View {
NavigationLink(title){ NavigationLink {
// ici mettre la vue sur les parties enregistrées à la place du texte n'hésite pas à tester sur la preview la navigation ça marche, faire pareil pour les autres // ici mettre la vue sur les parties enregistrées à la place du texte n'hésite pas à tester sur la preview la navigation ça marche, faire pareil pour les autres
content content
} label: {
Text(title)
.frame(maxWidth: .infinity)
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))
.controlSize(.large)
.foregroundColor(.white)
} }
.frame(maxWidth: .infinity) .buttonBorderShape(.roundedRectangle)
.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32)) .buttonStyle(.borderedProminent)
.buttonStyle(.bordered) .tint(.black)
.controlSize(.large)
.foregroundColor(.white)
.background(.black)
.buttonBorderShape(.roundedRectangle)
.clipShape(Capsule())
Spacer().frame(height: 50)
} }
} }

Loading…
Cancel
Save