comparison LazyBear/Views/Home/Helpers/CurrencyRow.swift @ 453:37c13ebda381

Improve hierarchy and minor bugs fixed
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Sun, 27 Jun 2021 14:18:29 +0200
parents 4effac4733b0
children
comparison
equal deleted inserted replaced
452:bb69f9d1d20f 453:37c13ebda381
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct CurrencyRow: View { 10 struct CurrencyRow: View {
11 var latestCurrencies: [CurrencyModel] 11 var latestCurrencies: [CurrencyModel]
12
13 @State private var showExtensiveList = false
14 12
15 var body: some View { 13 var body: some View {
16 VStack(alignment: .leading) { 14 VStack(alignment: .leading) {
17 HStack(alignment: .bottom) { 15 HStack(alignment: .bottom) {
18 VStack(alignment: .leading) { 16 VStack(alignment: .leading) {
26 .opacity(0.5) 24 .opacity(0.5)
27 .padding(.horizontal) 25 .padding(.horizontal)
28 } 26 }
29 27
30 Spacer() 28 Spacer()
31 Button("See all", action: { self.showExtensiveList = true }) 29 NavigationLink(destination: CurrencySheet(latestCurrencies: latestCurrencies)
32 .buttonStyle(BorderlessButtonStyle()) 30 .navigationTitle("Currencies")
31 ) {
32 HStack {
33 Text("See all")
34 Image(systemName: "chevron.right")
35 }
36 }
33 .padding(.horizontal) 37 .padding(.horizontal)
34 } 38 }
35 39
36 ScrollView(.horizontal, showsIndicators: false) { 40 ScrollView(.horizontal, showsIndicators: false) {
37 HStack(spacing: 20) { 41 HStack(spacing: 20) {
40 } 44 }
41 } 45 }
42 .padding() 46 .padding()
43 } 47 }
44 } 48 }
45 .sheet(isPresented: $showExtensiveList) {
46 CurrencySheet(latestCurrencies: latestCurrencies)
47 }
48 } 49 }
49 } 50 }
50 51
51 struct CurrencyRow_Previews: PreviewProvider { 52 struct CurrencyRow_Previews: PreviewProvider {
52 static var previews: some View { 53 static var previews: some View {