// // CalendarBoxView.swift // AcaMate // // Created by TAnine on 2/10/25. // import SwiftUI struct CalendarBoxView: View { @State var summaryCalDataList: [SummaryCalendar] var body: some View { DashBoardView(image: Image(.Icon.calendar), title: "최근 일정") { if summaryCalDataList.isEmpty { EmptyBoxView(title: "최근 일정이 없습니다.") } else { VStack(spacing: 12) { ForEach(Array(summaryCalDataList.enumerated()), id: \.offset) { index, data in CalCellView(summaryCalData: data) } } } } moreAction: { printLog("최근일정의 더보기") } } } struct CalCellView: View { var summaryCalData: SummaryCalendar var body: some View { VStack(spacing: 8) { HStack (spacing: 12) { Image(.Icon.clock) .resizable() .frame(width: 24, height: 24, alignment: .center) Text("\(summaryCalData.date)") .font(.nps(size: 20)) .foregroundStyle(Color(.Text.detail)) Spacer(minLength: 1) } HStack(spacing: 0) { Spacer(minLength: 1) Text("\(summaryCalData.summary)") .font(.nps(size: 20)) .foregroundStyle(Color(.Text.black)) .multilineStyle() } } .padding(12) .background { RoundedRectangle(cornerRadius: 4) .stroke(Color(.Second.normal), lineWidth: 2) .fill(Color(.Second.light)) } .onTapGesture { printLog("캘린더 내부 셀 클릭") // MARK: TO-DO // Summary의 날짜 위치로 이동하게 하는걸로 // SummaryCalendar' id 를 이용하는걸로 // 해당 날짜의 해당 이벤트가 아니라 그냥 해당 날짜로 이동하는게 좋을 것으로 보임 } } }