73 lines
2.3 KiB
Swift
73 lines
2.3 KiB
Swift
//
|
|
// CreatorNoticeWriteView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2023/08/11.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Combine
|
|
|
|
struct CreatorNoticeWriteView: View {
|
|
|
|
let notice: String
|
|
|
|
@ObservedObject var viewModel = CreatorNoticeWriteViewModel()
|
|
|
|
var body: some View {
|
|
BaseView(isLoading: $viewModel.isLoading) {
|
|
VStack(spacing: 0) {
|
|
DetailNavigationBar(title: "공지사항 쓰기")
|
|
|
|
TextViewWrapper(
|
|
text: $viewModel.writeNotice,
|
|
placeholder: viewModel.placeholder,
|
|
textColorHex: "eeeeee",
|
|
backgroundColorHex: "222222",
|
|
notice: notice
|
|
)
|
|
.frame(width: screenSize().width - 26.7, height: 300)
|
|
.padding(.top, 13.3)
|
|
|
|
Text("저장")
|
|
.font(.custom(Font.bold.rawValue, size: 18.3))
|
|
.foregroundColor(Color(hex: "ffffff"))
|
|
.padding(.vertical, 11.7)
|
|
.frame(width: screenSize().width - 26.7)
|
|
.background(Color(hex: "9970ff"))
|
|
.cornerRadius(5.3)
|
|
.padding(.top, 20)
|
|
.onTapGesture {
|
|
hideKeyboard()
|
|
viewModel.writeCreatorNotice()
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
|
|
HStack {
|
|
Spacer()
|
|
Text(viewModel.errorMessage)
|
|
.padding(.vertical, 13.3)
|
|
.frame(width: screenSize().width - 66.7, alignment: .center)
|
|
.font(.custom(Font.medium.rawValue, size: 12))
|
|
.background(Color(hex: "9970ff"))
|
|
.foregroundColor(Color.white)
|
|
.multilineTextAlignment(.leading)
|
|
.cornerRadius(20)
|
|
.padding(.bottom, 66.7)
|
|
Spacer()
|
|
}
|
|
}
|
|
.onTapGesture {
|
|
hideKeyboard()
|
|
}
|
|
.onAppear {
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
viewModel.writeNotice = notice
|
|
}
|
|
}
|
|
}
|
|
}
|