Untitled
unknown
swift
3 years ago
2.2 kB
11
Indexable
// Created by mac on 06/01/23.
//
import SwiftUI
struct CustomAlertButton: View {
// MARK: - Value
// MARK: Public
let title: LocalizedStringKey
var action: (() -> Void)? = nil
// MARK: - View
// MARK: Public
var body: some View {
Button {
action?()
} label: {
Text(title)
.font(.system(size: 14, weight: .medium))
.foregroundColor(.white)
.padding(.horizontal, 10)
}
.frame(height: 30)
.background(Color.purple)
.cornerRadius(15)
}
}
struct CommonAlertView: View {
@Binding var isShowCommonAlertView: Bool
@Binding var title: String
@Binding var message: String
// @Binding var dismissButton: CustomAlertButton?
var body: some View {
GeometryReader { geometry in
VStack{
VStack(spacing:15){
HStack(spacing:40){
Text(title)
.font(Font.custom(Fonts.product_medium, size: 16))
.fontWeight(.bold)
.foregroundColor(Color.init(hex: Colors.color_gr2))
Image("close-circle")
.resizable()
.frame(width: 20, height:20,alignment: .trailing)
}
// VStack{
Text(message)
.fontWeight(.light)
.padding()
.font(Font.custom(Fonts.product_medium, size: 14))
.foregroundColor(Color.init(hex: Colors.color_F6))
// }
// Button(){
//
// }label: {
// Text("")
// }
}
.frame(width:geometry.size.width*0.9, height:geometry.size.height*0.27)
.background(Color.init(hex: Colors.color_wh))
.cornerRadius(20)
}
.frame(width:geometry.size.width, height:geometry.size.height)
}
}
}
struct CommonAlertView_Previews: PreviewProvider {
static var previews: some View {
CommonAlertView(isShowCommonAlertView: .constant(true), title: .constant(""), message: .constant(""))
}
}
Editor is loading...