//
//  InfoView.swift
//  Werkout_ios
//
//  Created by Trey Tartt on 7/7/23.
//

import SwiftUI

struct InfoView: View {
    @ObservedObject var bridgeModule = BridgeModule.shared
    var workout: Workout
    
    var body: some View {
        VStack {
            Text(workout.name)
                .frame(maxWidth: .infinity, alignment: .leading)
                .font(.title3)
                .padding()
            
            if let desc = workout.description {
                Text(desc)
                    .frame(maxWidth: .infinity, alignment: .leading)
                    .font(.body)
                    .padding([.leading, .trailing])
            }
            
            if let estimatedTime = workout.estimatedTime {
                Text(estimatedTime.asString(style: .abbreviated))
                    .frame(maxWidth: .infinity, alignment: .leading)
                    .font(.body)
                    .padding([.leading, .trailing])
            }
        }
    }
}

struct InfoView_Previews: PreviewProvider {
    static var previews: some View {
        InfoView(workout: PreviewData.workout())
    }
}
