Mercurial > public > lazybear
comparison 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 |
comparison
equal
deleted
inserted
replaced
443:ffbb1dbab531 | 444:428109b1e3f0 |
---|---|
1 // | |
2 // InsiderTransactionsHelper.swift | |
3 // LazyBear | |
4 // | |
5 // Created by Dennis Concepción Martín on 22/6/21. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct InsiderTransactionsHelper: View { | |
11 var insiderTransactions: [InsiderTransactionModel] | |
12 @State private var showList = false | |
13 | |
14 var body: some View { | |
15 VStack(alignment: .leading) { | |
16 HStack { | |
17 Text("Insider Transactions") | |
18 .font(.title) | |
19 .fontWeight(.semibold) | |
20 | |
21 Spacer() | |
22 Button("See all", action: { showList = true } ) | |
23 } | |
24 .padding(.bottom) | |
25 | |
26 ForEach(insiderTransactions.prefix(4), id: \.self) { insiderTransaction in | |
27 InsiderTransactionsRow(insiderTransaction: insiderTransaction) | |
28 Divider() | |
29 } | |
30 } | |
31 .padding() | |
32 .background( | |
33 CustomRectangleBox() | |
34 ) | |
35 .sheet(isPresented: $showList) { | |
36 InsiderTransactionsList(insiderTransactions: insiderTransactions) | |
37 } | |
38 } | |
39 } | |
40 | |
41 struct InsiderTransactionsHelper_Previews: PreviewProvider { | |
42 static var previews: some View { | |
43 InsiderTransactionsHelper( | |
44 insiderTransactions: | |
45 [ | |
46 InsiderTransactionModel( | |
47 filingDate: "2020-01-01", | |
48 fullName: "Dennis Concepcion", | |
49 postShares: 1234, | |
50 reportedTitle: "Director", | |
51 transactionCode: "S", | |
52 transactionPrice: 20.08, | |
53 transactionShares: 12345, | |
54 transactionValue: 1234567.0 | |
55 ) | |
56 ] | |
57 ) | |
58 } | |
59 } |