// // ButtonView.swift // AcaMate // // Created by TAnine on 2/4/25. // import SwiftUI struct CircleBtnView: View { @ObservedObject var vm: ButtonViewModel let id: UUID var body: some View { if let state = vm.btnStates[id] { Button{ guard let action = state.action else {return} action() } label: { VStack(alignment: .center, spacing: 0) { if let image = state.image { image .resizable() .renderingMode(.template) .foregroundStyle(state.foreColor) .frame(width: state.width/2, height: state.height/2) } // if let title = state.title, let font = state.font { Text("\(title)") .font(font) .lineLimit(1) .minimumScaleFactor(0.5) .truncationMode(.tail) .foregroundStyle(state.textColor) // .padding() } } .background { if state.isReverse { Circle() .accentColor(state.backColor) .frame(width: state.width, height: state.height) .innerShadow(shape: Circle(), color: Color(.Text.black).opacity(0.75), blur: 8, x: 0, y: 4) } else { Circle() .accentColor(state.backColor) .frame(width: state.width, height: state.height) .shadow(color: Color(.Text.black).opacity(0.75), radius: 8, x: 4, y: 8) } } } } } }