//
//  RegisterView.swift
//  jason
//
//  Created by Jason on 2024/1/19.
//

import SwiftUI

struct RegisterView: View {
    @State private var username: String = ""
    @State private var password: String = ""
    @State private var showNext: Bool = false
    

    var body: some View {
        ScrollView {
            VStack (alignment: .leading, spacing: 12) {
//                Button(action: {
//                    dismiss()
//                }, label: {
//                    Image(systemName: "chevron.backward")
//                    Text("返回")
//                })
//                
                TextField("请输入用户名",text: $username)
                    .padding(.all, 12)
                    .cornerRadius(6)
                    .border(Color.gray)
                
                SecureField("请输入密码", text: $password)
                    .padding(.all, 12)
                    .cornerRadius(6)
                    .border(Color.gray)
            
                HStack {
                    Button("注册") {
                        showNext = true
                    }
                    .padding(.vertical, 12)
                    .padding(.horizontal, 32)
                    .foregroundColor(.white)

                    .cornerRadius(6)
                    .fullScreenCover(isPresented: $showNext, content: {
                        RegisterView()
                    })
                    
                    Spacer()
                    
                    Button("登录") {
                        
                    }
                    .padding(.vertical, 12)
                    .padding(.horizontal, 32)
                    .foregroundColor(.white)

                    .cornerRadius(6)
                }
            }
            .padding(.all, 12)
            .navigationTitle("注册")
            .navigationBarTitleDisplayMode(.large)
        }
    }
}

#Preview {
    RegisterView()
}
