view LazyBear/Views/Home/Helpers/SectorRow.swift @ 326:2fabdc393675

Testing networking in HomeView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Tue, 30 Mar 2021 23:13:14 +0200
parents 3e64824cca3e
children 80bfa88c6b0f
line wrap: on
line source

//
//  SectorRow.swift
//  LazyBear
//
//  Created by Dennis Concepción Martín on 28/3/21.
//

import SwiftUI

struct SectorRow: View {
    var sectorPerformance: [SectorPerformanceModel]
    
    var body: some View {
        VStack(alignment: .leading) {
            Text("Performance by sector")
                .font(.title3)
                .fontWeight(.semibold)
                .padding([.top, .horizontal])
            
            ScrollView(.horizontal, showsIndicators: false) {
                HStack(spacing: 20) {
                    ForEach(sectorPerformance, id: \.self) { sector in
                        SectorItem(sector: sector)
                    }
                }
                .padding()
            }
            .frame(height: 170)
        }
        .padding(.bottom)
    }
}

struct SectorRow_Previews: PreviewProvider {
    static var previews: some View {
        SectorRow(sectorPerformance: [SectorPerformanceModel(name: "Technology", performance: 0.04, lastUpdated: 1617137138)])
    }
}