diff --git a/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift b/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift index 07139f8..566cfb4 100644 --- a/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift +++ b/DouShouQi_App/DouShouQi_App/Components/Player/ShowAllPlayer.swift @@ -2,7 +2,49 @@ // ShowAllPlayer.swift // DouShouQi_App // -// Created by etudiant on 14/06/2024. +// Created by Nathan Verdier on 14/06/2024. // -import Foundation +import SwiftUI +import UIKit + +struct ShowAllPlayer: View { + @Binding var isShowingSheet: Bool + @Binding var players: [Player] + var body: some View { + Button(action: { + self.isShowingSheet = true + }) { + Text("Afficher les joueurs") + } + .sheet(isPresented: $isShowingSheet) { + PlayerSheetView(isShowingSheet: $isShowingSheet, players: $players) + } + } +} + +struct PlayerSheetView: View { + @Environment(\.dismiss) var dismiss + @Binding var isShowingSheet: Bool + @Binding var players: [Player] + + var body: some View { + VStack { + /*List(players, id: \.self) { player in + Text(player.name) // Assumant que Player a une propriété 'name' + }*/ + Button(action: { + self.isShowingSheet = true + }) { + Text("Add Player") + .foregroundColor(.white) + .padding() + .background(Color.red) + .cornerRadius(10) + } + .sheet(isPresented: $isShowingSheet) { + AddPlayerView(isPresented: $isShowingSheet, players: $players) + } + } + } +}