117 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  LivePaymentDialog.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 1/21/24.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
 | 
						|
struct LivePaymentDialog: View {
 | 
						|
    
 | 
						|
    let title: String
 | 
						|
    let desc: String
 | 
						|
    let desc2: String?
 | 
						|
    let confirmButtonTitle: String
 | 
						|
    let confirmButtonAction: () -> Void
 | 
						|
    let cancelButtonTitle: String
 | 
						|
    let cancelButtonAction: () -> Void
 | 
						|
    
 | 
						|
    let startDateTime: String?
 | 
						|
    let nowDateTime: String?
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        VStack {
 | 
						|
            Text(title)
 | 
						|
                .font(.custom(Font.bold.rawValue, size: 18.3))
 | 
						|
                .foregroundColor(Color.graybb)
 | 
						|
            
 | 
						|
            Text(desc)
 | 
						|
                .font(.custom(Font.medium.rawValue, size: 15))
 | 
						|
                .foregroundColor(Color.graybb)
 | 
						|
                .multilineTextAlignment(.center)
 | 
						|
                .lineSpacing(6)
 | 
						|
                .padding(.top, 21.3)
 | 
						|
            
 | 
						|
            if let startDateTime = startDateTime, let nowDateTime = nowDateTime, let desc = desc2 {
 | 
						|
                VStack(spacing: 13.3) {
 | 
						|
                    HStack(spacing: 6.7) {
 | 
						|
                        Text("- 시작 시각 : ")
 | 
						|
                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                            .foregroundColor(Color.graybb)
 | 
						|
                        
 | 
						|
                        Text(startDateTime)
 | 
						|
                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                            .foregroundColor(Color.graybb)
 | 
						|
                    }
 | 
						|
                    
 | 
						|
                    HStack(spacing: 6.7) {
 | 
						|
                        Text("- 현재 시각 :")
 | 
						|
                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                            .foregroundColor(Color.graybb)
 | 
						|
                            .multilineTextAlignment(.leading)
 | 
						|
                        
 | 
						|
                        Text(nowDateTime)
 | 
						|
                            .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                            .foregroundColor(Color.graybb)
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                .padding(.vertical, 13.3)
 | 
						|
                .padding(.horizontal, 26.7)
 | 
						|
                .background(Color.gray30)
 | 
						|
                .cornerRadius(13.3)
 | 
						|
                .padding(.top, 21.3)
 | 
						|
                
 | 
						|
                Text(desc)
 | 
						|
                    .font(.custom(Font.medium.rawValue, size: 15))
 | 
						|
                    .foregroundColor(Color.graybb)
 | 
						|
                    .lineSpacing(6)
 | 
						|
                    .padding(.top, 21.3)
 | 
						|
            }
 | 
						|
            
 | 
						|
            HStack(spacing: 13.3) {
 | 
						|
                Text("취소")
 | 
						|
                    .font(.custom(Font.bold.rawValue, size: 18.3))
 | 
						|
                    .foregroundColor(Color.button)
 | 
						|
                    .padding(.vertical, 16)
 | 
						|
                    .frame(maxWidth: .infinity)
 | 
						|
                    .background(Color.bg)
 | 
						|
                    .cornerRadius(10)
 | 
						|
                    .overlay(
 | 
						|
                        RoundedRectangle(cornerRadius: 8)
 | 
						|
                        .stroke(Color(hex: "3bb9f1"), lineWidth: 1)
 | 
						|
                    )
 | 
						|
                    .onTapGesture { cancelButtonAction() }
 | 
						|
                
 | 
						|
                Text("결제 후 입장")
 | 
						|
                    .font(.custom(Font.bold.rawValue, size: 18.3))
 | 
						|
                    .padding(.vertical, 16)
 | 
						|
                    .frame(maxWidth: .infinity)
 | 
						|
                    .background(Color.button)
 | 
						|
                    .cornerRadius(10)
 | 
						|
                    .onTapGesture { confirmButtonAction() }
 | 
						|
            }
 | 
						|
            .padding(.top, 45)
 | 
						|
        }
 | 
						|
        .padding(.horizontal, 16.7)
 | 
						|
        .padding(.bottom, 16.7)
 | 
						|
        .padding(.top, 40)
 | 
						|
        .background(Color(hex: "222222"))
 | 
						|
        .cornerRadius(10)
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
#Preview {
 | 
						|
    LivePaymentDialog(
 | 
						|
        title: "유료 라이브 입장",
 | 
						|
        desc: "OO캔을 차감하고\n라이브에 입장 하시겠습니까?",
 | 
						|
        desc2: "라이브가 시작한 지 1시간 10분이 지났습니다. 라이브에 입장 후 30분 이내에 라이브가 종료될 수도 있습니다.",
 | 
						|
        confirmButtonTitle: "",
 | 
						|
        confirmButtonAction: {},
 | 
						|
        cancelButtonTitle: "",
 | 
						|
        cancelButtonAction: {},
 | 
						|
        startDateTime: "2024-01-01 15:00",
 | 
						|
        nowDateTime: "2024-01-02 15:00"
 | 
						|
    )
 | 
						|
}
 |