AcaMate_iOS/AcaMate/1. View/12. Main/121. Button/SimpleBtnView.swift
2025-02-05 17:59:49 +09:00

48 lines
1.1 KiB
Swift

//
// SimpleBtnView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct SimpleBtnView: View {
let title: String?
let image: Image?
let font: Font?
let width: CGFloat
let height: CGFloat
var isUsable: Bool = true
let action: VOID_TO_VOID?
var body: some View {
Button{
guard let action = action else { return }
action()
} label: {
if let title = title, let font = font {
Text("\(title)")
.font(font)
.tint(Color(.Second.dark))
.frame(width: width, height: height)
}
else if let image = image {
image
.resizable()
.frame(width: width, height: height)
}
}
.disabled(isUsable)
}
}
#Preview {
SimpleBtnView(title: "체크 합니다", image: Image(.BottomBar.home),
font: .nps(font: .bold, size: 12),
width: 40, height: 40,
action: nil)
}