//
//  DateBoxView.swift
//  PadelClub
//
//  Created by Razmig Sarkissian on 29/02/2024.
//

import SwiftUI

struct DateVerticalView: View {
    let date: Date
    var body: some View {
        VStack(alignment: .trailing, spacing: 0.0) {
            DateView(date: self.date)
            MonthYearView(date: self.date)
        }
    }
}

struct DateView: View {
    let date: Date
    var body: some View {
        VStack(alignment: .center, spacing: 0.0) {
            Text(self.date.formatted(.dateTime.weekday(.abbreviated)).uppercased())
            Text(self.date.formatted(.dateTime.day(.twoDigits)))
                .font(.title3).fontWeight(.semibold)
                .monospacedDigit()
        }
    }
}

struct MonthYearView: View {
    let date: Date
    var body: some View {
        Text(date.formatted(.dateTime.month(.abbreviated)).uppercased())
        Text(date.formatted(.dateTime.year()))
    }
}

//struct DateBoxView: View {
//    let date: Date
//    var displayStyle: DisplayStyle = .wide
//    
//    var body: some View {
//        VStack(alignment: .center, spacing: 0.0) {
//            Text(date.formatted(.dateTime.weekday(.abbreviated)).uppercased())
//            HStack(alignment: .bottom) {
//                Text(date.formatted(.dateTime.day(.twoDigits)))
//                    .font(displayStyle == .wide ? .title : .title3)
//                    .monospacedDigit()
//                    .padding(-2)
//            }
//            if displayStyle == .wide {
//                Text(date.formatted(.dateTime.month(.abbreviated)).uppercased())
//                Text(date.formatted(.dateTime.year()))
//            }
//        }
//        .font(.footnote)
////        .fontWeight(.semibold)
//    }
//}

//#Preview {
//    DateVerticalView(date: Date())
//}
