import SwiftUI

struct PublicationView: View {
    
    @Environment(\.colorScheme)
    var colorScheme: ColorScheme
    
    let info: Publication

    let borderSpacing: CGFloat

    let borderWidth: CGFloat

    let accent: Color

    var body: some View {
        LeftBorderView(color: accent, spacing: borderSpacing, borderWidth: borderWidth) {
            VStack(alignment: .leading) {
                Text(info.venue)
                    .font(.caption)
                    .foregroundColor(colorScheme.secondaryColor)
                Text(info.title)
                    .font(.subheadline)
                    .fontWeight(.regular)
                    .foregroundColor(colorScheme.primaryColor)
            }
        }
    }
}

struct PublicationView_Previews: PreviewProvider {
    static var previews: some View {
        PublicationView(info: .init(
            venue: "My venue",
            title: "The publication title"),
                        borderSpacing: 5,
                        borderWidth: 3,
                        accent: .orange)
    }
}
