//
//  OrderListView.swift
//  SodaLive
//
//  Created by klaus on 2023/08/24.
//

import SwiftUI

struct OrderListView: View {
    let items: [GetAudioContentOrderListItem]
    
    var body: some View {
        VStack(spacing: 0) {
            HStack(spacing: 0) {
                Text("콘텐츠 보관함")
                    .font(.custom(Font.bold.rawValue, size: 18))
                    .foregroundColor(Color(hex: "eeeeee"))
                
                Spacer()
                
                Text("전체보기")
                    .font(.custom(Font.medium.rawValue, size: 11))
                    .foregroundColor(Color.graybb)
                    .onTapGesture {
                        AppState.shared.setAppStep(step: .orderListAll)
                    }
            }
            
            VStack(spacing: 13.3) {
                ForEach(0..<items.count, id: \.self) { index in
                    let item = items[index]
                    OrderListItemView(item: item)
                        .contentShape(Rectangle())
                        .onTapGesture {
                            AppState
                                .shared
                                .setAppStep(step: .contentDetail(contentId: item.contentId))
                        }
                }
            }
            .padding(.top, 26.7)
        }
        .padding(.horizontal, 13.3)
    }
}