diff Simoleon/Helpers/CurrencySelectorButton.swift @ 179:7c4a789e51ba

add views
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Tue, 26 Oct 2021 18:18:36 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Simoleon/Helpers/CurrencySelectorButton.swift	Tue Oct 26 18:18:36 2021 +0200
@@ -0,0 +1,39 @@
+//
+//  CurrencySelectorButton.swift
+//  Simoleon
+//
+//  Created by Dennis Concepción Martín on 26/10/21.
+//
+
+import SwiftUI
+
+struct CurrencySelectorButton: View {
+    var selectedCurrency: CurrencyModel
+    
+    var body: some View {
+        RoundedRectangle(cornerRadius: 15)
+            .foregroundColor(Color(.secondarySystemBackground))
+            .frame(height: 60)
+            .overlay(
+                HStack {
+                    Image(selectedCurrency.code)
+                        .resizable()
+                        .aspectRatio(contentMode: .fill)
+                        .frame(width: 35, height: 35)
+                        .clipShape(Circle())
+                    
+                    Text(selectedCurrency.code)
+                        .foregroundColor(.primary)
+                        .font(.headline)
+                }
+            )
+    }
+}
+
+struct CurrencySelectorButton_Previews: PreviewProvider {
+    static var previews: some View {
+        CurrencySelectorButton(
+            selectedCurrency: CurrencyModel(name: "US Dollar", code: "USD")
+        )
+    }
+}