view LazyBear/Views/Search/Helpers/PopularCompanyHelper.swift @ 339:e81c18164afb

Fixing backend API Requests
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 03 Apr 2021 13:02:40 +0200
parents
children
line wrap: on
line source

//
//  PopularCompanyHelper.swift
//  LazyBear
//
//  Created by Dennis Concepción Martín on 1/4/21.
//

import SwiftUI

struct PopularCompanyHelper: View {
    var company: CompanyQuoteModel
    
    var body: some View {
        RoundedRectangle(cornerRadius: 20)
            .foregroundColor(Color(.secondarySystemBackground))
            .frame(height: 100)
            .overlay(
                HStack {
                     Rectangle()
                         .frame(width: 15)
                         .foregroundColor(Color("default"))
                    
                    VStack {
                        Text(company.companyName)
                        Text(company.symbol)
                    }
                    
                    Spacer()
                    
                    PriceView(latestPrice: company.latestPrice, changePercent: company.changePercent)
                }
                .clipShape(RoundedRectangle(cornerRadius: 20))
            )
    }
}

struct PopularCompanyHelper_Previews: PreviewProvider {
    static var previews: some View {
        PopularCompanyHelper(company: CompanyQuoteModel(companyName: "apple inc", symbol: "aapl", latestPrice: 120.30, changePercent: 0.03))
    }
}