//
//  NoticeDetailView.swift
//  SodaLive
//
//  Created by klaus on 2023/08/10.
//

import SwiftUI
import RichText

struct NoticeDetailView: View {
    
    let notice: NoticeItem
    
    var body: some View {
        BaseView {
            VStack(spacing: 0) {
                DetailNavigationBar(title: "공지사항 상세")
                
                VStack(alignment: .leading, spacing: 6.7) {
                    Text(notice.title)
                        .font(.custom(Font.medium.rawValue, size: 14.7))
                        .foregroundColor(Color(hex: "eeeeee"))
                        .padding(.horizontal, 13.3)
                    
                    Text(notice.date)
                        .font(.custom(Font.medium.rawValue, size: 12))
                        .foregroundColor(Color(hex: "525252"))
                        .padding(.horizontal, 13.3)
                }
                .padding(.horizontal, 13.3)
                .padding(.vertical, 21.7)
                .frame(width: screenSize().width - 26.7, alignment: .leading)
                .background(Color(hex: "222222"))
                .cornerRadius(6.7)
                
                ScrollView(.vertical, showsIndicators: false) {
                    RichText(html: notice.content)
                        .padding(.horizontal, 33.3)
                        .padding(.vertical, 26.7)
                }
            }
        }
    }
}

struct NoticeDetailView_Previews: PreviewProvider {
    static var previews: some View {
        NoticeDetailView(
            notice: NoticeItem(
                title: "제목",
                content: "<h1>콘텐츠</h1>",
                date: "2022.03.03"
            )
        )
    }
}
