forked from AcaMate/AcaMate_iOS
74 lines
2.2 KiB
Swift
74 lines
2.2 KiB
Swift
//
|
|
// NoticeBoxView.swift
|
|
// AcaMate
|
|
//
|
|
// Created by TAnine on 2/11/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct NoticeBoxView: View {
|
|
@State var noticeList: [SummaryNotice]
|
|
|
|
var body: some View {
|
|
DashBoardView(image: Image(.Icon.notice), title: "공지사항") {
|
|
if noticeList.isEmpty {
|
|
EmptyBoxView(title: "공지가 없습니다.")
|
|
} else {
|
|
VStack(spacing: 12) {
|
|
ForEach(Array(noticeList.enumerated()), id: \.offset) { index, notice in
|
|
if index < 3 {
|
|
NotiCellView(summaryNoti: notice)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} moreAction: {
|
|
// MARK: TO-DO
|
|
// 공지사항 전체 페이지 이동 로직 추가
|
|
printLog("공지사항의 더보기")
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
struct NotiCellView: View {
|
|
var summaryNoti: SummaryNotice
|
|
|
|
var body: some View {
|
|
VStack(spacing: 8) {
|
|
HStack(spacing: 12) {
|
|
Image(summaryNoti.new ? .Icon.noticeNew : .Icon.noticeOld)
|
|
.resizable()
|
|
.frame(width: 24, height: 24, alignment: .center)
|
|
Text("\(summaryNoti.title)")
|
|
.font(.nps(size: 20))
|
|
.foregroundStyle(Color(.Text.title))
|
|
Spacer(minLength: 1)
|
|
}
|
|
HStack(spacing: 4) {
|
|
Spacer(minLength: 1)
|
|
Text("날짜 :")
|
|
.font(.nps(size: 12))
|
|
.foregroundStyle(Color(.Text.detail))
|
|
Text("\(summaryNoti.date)")
|
|
.font(.nps(size: 12))
|
|
.frame(width: 80)
|
|
.foregroundStyle(Color(.Text.detail))
|
|
}
|
|
}
|
|
.padding(12)
|
|
.background {
|
|
RoundedRectangle(cornerRadius: 4)
|
|
.stroke(Color(.Second.normal), lineWidth: 2)
|
|
.fill(Color(.Second.light))
|
|
}
|
|
.onTapGesture {
|
|
printLog("공지사항 내부 셀 클릭")
|
|
// MARK: TO-DO
|
|
}
|
|
}
|
|
}
|