라이브 메인 페이지
This commit is contained in:
107
SodaLive/Sources/Dialog/SodaDialog.swift
Normal file
107
SodaLive/Sources/Dialog/SodaDialog.swift
Normal file
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// SodaDialog.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/10.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SodaDialog: View {
|
||||
|
||||
let title: String
|
||||
let desc: String
|
||||
let confirmButtonTitle: String
|
||||
let confirmButtonAction: () -> Void
|
||||
let cancelButtonTitle: String
|
||||
let cancelButtonAction: () -> Void
|
||||
|
||||
init(
|
||||
title: String,
|
||||
desc: String,
|
||||
confirmButtonTitle: String,
|
||||
confirmButtonAction: @escaping () -> Void,
|
||||
cancelButtonTitle: String = "",
|
||||
cancelButtonAction: @escaping () -> Void = {}
|
||||
) {
|
||||
self.title = title
|
||||
self.desc = desc
|
||||
self.confirmButtonTitle = confirmButtonTitle
|
||||
self.confirmButtonAction = confirmButtonAction
|
||||
self.cancelButtonTitle = cancelButtonTitle
|
||||
self.cancelButtonAction = cancelButtonAction
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geo in
|
||||
ZStack {
|
||||
Color.black
|
||||
.opacity(0.5)
|
||||
.frame(width: geo.size.width, height: geo.size.height)
|
||||
|
||||
VStack(spacing: 0) {
|
||||
Text(title)
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.padding(.top, 40)
|
||||
|
||||
Text(desc)
|
||||
.font(.custom(Font.medium.rawValue, size: 15))
|
||||
.foregroundColor(Color(hex: "bbbbbb"))
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.top, 12)
|
||||
.padding(.horizontal, 13.3)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
if cancelButtonTitle.count > 0 {
|
||||
Text(cancelButtonTitle)
|
||||
.font(.custom(Font.bold.rawValue, size: 15.3))
|
||||
.foregroundColor(Color(hex: "9970ff"))
|
||||
.padding(.vertical, 16)
|
||||
.frame(width: (geo.size.width - 66.7) / 3)
|
||||
.background(Color(hex: "9970ff").opacity(0.13))
|
||||
.cornerRadius(8)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 8)
|
||||
.stroke(Color(hex: "9970ff"), lineWidth: 1)
|
||||
)
|
||||
.onTapGesture {
|
||||
cancelButtonAction()
|
||||
}
|
||||
}
|
||||
|
||||
Text(confirmButtonTitle)
|
||||
.font(.custom(Font.bold.rawValue, size: 15.3))
|
||||
.foregroundColor(Color(hex: "ffffff"))
|
||||
.padding(.vertical, 16)
|
||||
.frame(width: (geo.size.width - 66.7) * 2 / 3)
|
||||
.background(Color(hex: "9970ff"))
|
||||
.cornerRadius(8)
|
||||
.onTapGesture {
|
||||
confirmButtonAction()
|
||||
}
|
||||
}
|
||||
.padding(.top, 45)
|
||||
.padding(.bottom, 16.7)
|
||||
}
|
||||
.frame(width: geo.size.width - 26.7, alignment: .center)
|
||||
.background(Color(hex: "222222"))
|
||||
.cornerRadius(10)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SodaDialog_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SodaDialog(
|
||||
title: "작성글 등록",
|
||||
desc: "작성한 글을 등록하시겠습니까?",
|
||||
confirmButtonTitle: "결제 후 입장",
|
||||
confirmButtonAction: {},
|
||||
cancelButtonTitle: "취소",
|
||||
cancelButtonAction: {}
|
||||
)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user