forked from AcaMate/AcaMate_iOS
57 lines
1.7 KiB
Swift
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 foreColor: 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.foreColor)
|
|
.frame(width: 24, height: 24)
|
|
if let title = self.title {
|
|
Text("\(title)")
|
|
.font(.nps(font: .bold, size: 6))
|
|
.foregroundStyle(self.foreColor)
|
|
}
|
|
}
|
|
.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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|