// // NoticeListView.swift // SodaLive // // Created by klaus on 2023/08/10. // import SwiftUI import RichText struct NoticeListView: View { @ObservedObject var viewModel = NoticeListViewModel() var body: some View { BaseView(isLoading: $viewModel.isLoading) { VStack(spacing: 0) { DetailNavigationBar(title: "공지사항") ScrollView(.vertical, showsIndicators: false) { VStack(spacing: 0) { ForEach(viewModel.notices, id: \.self) { notice in VStack(alignment: .leading, spacing: 6.7) { Spacer() Text(notice.title) .appFont(size: 14.7, weight: .medium) .foregroundColor(Color(hex: "eeeeee")) .padding(.horizontal, 13.3) Text(notice.date) .appFont(size: 12, weight: .medium) .foregroundColor(Color(hex: "525252")) .padding(.horizontal, 13.3) Spacer() Rectangle() .frame(height: 1) .foregroundColor(Color(hex: "909090").opacity(0.5)) } .padding(.horizontal, 13.3) .frame(width: screenSize().width, height: 80) .contentShape(Rectangle()) .onTapGesture { AppState.shared.setAppStep(step: .noticeDetail(notice: notice)) } } } } .padding(.vertical, 13.3) } } .sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 2) .onAppear { viewModel.getNotices() } } } struct NoticeListView_Previews: PreviewProvider { static var previews: some View { NoticeListView() } }