//
//  EditModalView.swift
//  DouShouQiIOS
//
//  Created by Pierre FERREIRA on 03/06/2024.
//

import SwiftUI
import DouShouQiModel

struct EditModalView: View {
    
    var playerVM : PlayerVM
    @Binding var isEdited : Bool
    var name : String = ""
    var body: some View {
        VStack{
            TextField("Entrez un nom ici",text: .constant(""))
            
        }.padding()
        .toolbar {
            Button(action: {playerVM.onEdited()}, label: {Text("Done")})
            Button(action: {playerVM.onEdited(isCanceled: true)}, label: {Text("Cancel")})
        }
    }
}

struct EditModalView_Previews: PreviewProvider {
    static var previews: some View {
        EditModalView(playerVM: PlayerVM(with:Player(withName: "toto", andId: .player2)!), isEdited: .constant(true))
    }
}
