//
//  UserView.swift
//  jason
//
//  Created by Jason on 2024/1/16.
//

import SwiftUI

struct UserView: View {
    @State private var toLogin: Bool = false
    
    var body: some View {
        NavigationView        {
            ScrollView {
                VStack (alignment: .leading, spacing: 12) {
                    Header
                    
                    ToVip
                    
                    
                    
                    //
                    //                    NavigationLink(destination: LoginView(), label: {
                    //                        Text("qu zhuce ")
                    //                    })
                    //                    Button("登录"){
                    //                        toLogin = true
                    //                    }
                    //                    .padding(.vertical, 12)
                    //                    .padding(.horizontal, 32)
                    //                    .foregroundColor(.white)
                    //                    .background(Color.blue)
                    //                    .cornerRadius(12)
                    //                    .fullScreenCover(isPresented: $toLogin, content: {
                    //                        LoginView()
                    //                    })
                }
                
            }
        }
    }
    
    var Header : some View {
        HStack {
                Image("Images/logo")
                    .resizable()
                    .frame(width: 64, height: 64)
                    .cornerRadius(32)
                    .overlay(
                        RoundedRectangle(cornerRadius: 32, style: .continuous)
                            .stroke(Color.red, lineWidth: 2)
                    )
                
                VStack (alignment: .leading, spacing: 12, content: {
                    Text("用户名称")
                        .font(.title2)
                        .fontWeight(.regular)
                    Text("我的用户简介，超出部分需要隐藏，隐藏需要自动设置，这个文字长度也要有约束")
                        .font(.caption)
                        .foregroundColor(Color.gray)
                        .lineLimit(1)
                })
                
                Image(systemName: "gearshape")
                    .foregroundColor(Color.gray)
            }
            .padding(.horizontal, 16)
    }
    
    var ToVip: some View {
        HStack(spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: {
            Spacer()
            Button("立即开通") {
                
            }
            .foregroundColor(Color.red)
            .font(.subheadline)
            .padding(.vertical, 8)
            .padding(.horizontal, 16)
            .background(Color.gray)
            .cornerRadius(32)
        })
        .padding(16)
        .frame(maxWidth: .infinity)
        .frame( height: 64)
        .background(Image("Images/banner3").resizable().cornerRadius(/*@START_MENU_TOKEN@*/12.0/*@END_MENU_TOKEN@*/))
        .padding(.horizontal, 16)
    }
}
#Preview {
    UserView()
}
