diff Simoleon/UI/CurrencyRow.swift @ 156:84137052813d

Refactor code
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Sat, 28 Aug 2021 11:15:25 +0100
parents
children 1940db1ef321
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Simoleon/UI/CurrencyRow.swift	Sat Aug 28 11:15:25 2021 +0100
@@ -0,0 +1,41 @@
+//
+//  CurrencyRow.swift
+//  Simoleon
+//
+//  Created by Dennis Concepción Martín on 15/07/2021.
+//
+
+import SwiftUI
+
+struct CurrencyRow: View {
+    var currency: CurrencyModel
+    
+    var body: some View {
+        HStack {
+            Flag(flag: currency.flag)
+            VStack(alignment: .leading) {
+                Text(currency.symbol)
+                    .font(.headline)
+                
+                Text(currency.name)
+                    .font(.subheadline)
+                    .lineLimit(1)
+            }
+            .padding(.horizontal)
+        }
+    }
+}
+
+struct CurrencyRow_Previews: PreviewProvider {
+    static var previews: some View {
+        CurrencyRow(
+            currency:
+                CurrencyModel(
+                    symbol: "USD",
+                    name: "United States Dollar",
+                    flag: "US",
+                    isCrypto: false
+                )
+        )
+    }
+}