Mercurial > public > lazybear
diff LazyBear/Views/Home/Helpers/CurrencySheetRow.swift @ 424:6dd97877f575
Improve code, reorganize files
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 13 Jun 2021 19:40:42 +0200 |
parents | LazyBear/Views/Home/Helpers/CurrencyListItem.swift@eb97439e46cd |
children | 4effac4733b0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LazyBear/Views/Home/Helpers/CurrencySheetRow.swift Sun Jun 13 19:40:42 2021 +0200 @@ -0,0 +1,39 @@ +// +// CurrencySheetRow.swift +// LazyBear +// +// Created by Dennis Concepción Martín on 13/6/21. +// + +import SwiftUI + +struct CurrencySheetRow: View { + var currencySymbol: String + var currency: CurrencyModel + + var body: some View { + HStack { + Text(currency.flag) + .padding(.trailing) + + VStack(alignment: .leading) { + Text("USD/\(currencySymbol)") + .font(.headline) + + Text(currency.name) + .font(.callout) + } + + Spacer() + Text("\(currency.rate, specifier: "%.2f")") + .fontWeight(.semibold) + .padding(.horizontal) + } + } +} + +struct CurrencySheetRow_Previews: PreviewProvider { + static var previews: some View { + CurrencySheetRow(currencySymbol: "AUD", currency: CurrencyModel(flag: "🇦🇺", name: "Australian dollar", rate: 1.2938)) + } +}