Mercurial > public > lazybear
diff LazyBear/Views/Company/Helpers/InsiderTransactionsHelper.swift @ 444:428109b1e3f0
InsiderTransactions implemented
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Tue, 22 Jun 2021 16:54:21 +0200 |
parents | |
children | 7d1c4dc8d1d8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Views/Company/Helpers/InsiderTransactionsHelper.swift Tue Jun 22 16:54:21 2021 +0200 @@ -0,0 +1,59 @@ +// +// InsiderTransactionsHelper.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 22/6/21. +// + +import SwiftUI + +struct InsiderTransactionsHelper: View { + var insiderTransactions: [InsiderTransactionModel] + @State private var showList = false + + var body: some View { + VStack(alignment: .leading) { + HStack { + Text("Insider Transactions") + .font(.title) + .fontWeight(.semibold) + + Spacer() + Button("See all", action: { showList = true } ) + } + .padding(.bottom) + + ForEach(insiderTransactions.prefix(4), id: \.self) { insiderTransaction in + InsiderTransactionsRow(insiderTransaction: insiderTransaction) + Divider() + } + } + .padding() + .background( + CustomRectangleBox() + ) + .sheet(isPresented: $showList) { + InsiderTransactionsList(insiderTransactions: insiderTransactions) + } + } +} + +struct InsiderTransactionsHelper_Previews: PreviewProvider { + static var previews: some View { + InsiderTransactionsHelper( + insiderTransactions: + [ + InsiderTransactionModel( + filingDate: "2020-01-01", + fullName: "Dennis Concepcion", + postShares: 1234, + reportedTitle: "Director", + transactionCode: "S", + transactionPrice: 20.08, + transactionShares: 12345, + transactionValue: 1234567.0 + ) + ] + ) + } +}