//
//  PodcastListDetail.swift
//  PodcastsApp
//
//  Created by BREUIL Yohann on 16/05/2023.
//

import SwiftUI

struct PodcastListItem: View {
    var podcast: Podcast
    
    var body: some View {
        VStack(alignment: .leading) {
            Image(podcast.coverImage)
                .resizable()
                .aspectRatio(contentMode: .fill)
                .cornerRadius(8)
            VStack(alignment: .leading) {
                Text(podcast.name)
                    .bold()
                Text("Mise à jour : Il y a 2j")
            }
            .aspectRatio(contentMode: .fit)
        }
        .frame(width: 175, height: 175)
    }
}

struct PodcastListDetail_Previews: PreviewProvider {
    static var previews: some View {
        let podcast: Podcast = Podcast(
            name: "Underscore_",
            creator: "Micode",
            coverImage: "underscore_podcast",
            nbStars: 4.7,
            nbEvaluations: 963,
            topic: "Technologies",
            lastUpdateDate: Date.now)
        
        Group {
            PodcastListItem(podcast: podcast)
            PodcastListItem(podcast: podcast).preferredColorScheme(.dark)
        }
    }
}
