From 581d2a5a2d13b89953d43628d600dfda5afa3b16 Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 14 Jun 2024 09:39:18 +0200 Subject: [PATCH] :construction: Update: ShowAllPlayer for list all player --- .../Components/Player/ShowAllPlayer.swift | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) 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) + } + } + } +}