//
//  ContentMainTabHomeNoticeView.swift
//  SodaLive
//
//  Created by klaus on 2/20/25.
//

import SwiftUI

struct ContentMainTabHomeNoticeView: View {
    
    let notice: NoticeItem
    let onClick: (NoticeItem) -> Void
    
    var body: some View {
        HStack(spacing: 0) {
            Text(notice.title)
                .font(.custom(Font.medium.rawValue, size: 13.3))
                .foregroundColor(.white)
            
            Spacer()
            
            Text("자세히 >")
                .font(.custom(Font.medium.rawValue, size: 13.3))
                .foregroundColor(.white)
                .onTapGesture {
                    onClick(notice)
                }
        }
        .padding(.horizontal, 13.3)
        .padding(.vertical, 10)
        .background(Color.gray22)
        .cornerRadius(5.3)
    }
}

#Preview {
    ContentMainTabHomeNoticeView(
        notice: NoticeItem(
            title: "[업데이트] 1.28.0 버전 업데이트",
            content: "test",
            date: "2025-02-07"
        )
    ) {
        AppState.shared.setAppStep(step: .noticeDetail(notice: $0))
    }
}
