import SwiftUI

struct TitledTextSection: View {

    let content: Titled<String>

    let titleSpacing: CGFloat

    let paragraphSpacing: CGFloat
    
    var body: some View {
        TitledSection(title: content.title, spacing: titleSpacing) {
            ForEach(content.items) { text in
                Text(text)
                    .font(.body)
                    .fontWeight(.light)
                    .padding(.bottom, paragraphSpacing)
            }
        }
    }
}

struct TitledTextSection_Previews: PreviewProvider {
    static var previews: some View {
        TitledTextSection(
            content: .init(
                title: "Title",
                items: ["Some longer or shorter text to explain some feature."]),
            titleSpacing: 10,
            paragraphSpacing: 5)
    }
}
