AcaMate_iOS/AcaMate/1. View/12. Main/121. Button/CircleBtnView.swift
2025-02-04 18:03:47 +09:00

57 lines
1.7 KiB
Swift

//
// ButtonView.swift
// AcaMate
//
// Created by TAnine on 2/4/25.
//
import SwiftUI
struct CircleBtnView: View {
let title: String?
let image: Image
@Binding var isSelected: Bool
let isReverse: Bool
let action: VOID_TO_VOID?
var backColor: Color {isReverse ? Color(.Second.light) : Color(.Normal.normal)}
var tintColor: Color {isSelected ? Color(.Second.normal) : Color(.Disable.normal)}
var body: some View {
Button{
guard let action = action else {return}
action()
} label: {
VStack(alignment: .center, spacing: 0) {
self.image
.resizable()
.renderingMode(.template)
.foregroundStyle(self.tintColor)
.frame(width: 24, height: 24)
if let title = self.title {
Text("\(title)")
.font(.nps(font: .bold, size: 6))
.tint(self.tintColor)
}
}
.padding()
.background {
if isReverse {
Circle()
.accentColor(self.backColor)
.frame(width: 48, height: 48)
.innerShadow(shape: Circle(), color: Color(.Text.black).opacity(0.75), blur: 8, x: 0, y: 4)
} else {
Circle()
.accentColor(self.backColor)
.frame(width: 48, height: 48)
.shadow(color: Color(.Text.black).opacity(0.75), radius: 8, x: 4, y: 8)
}
}
}
}
}