BlueWallet/ios/Widgets/Shared/Views/MarketView.swift

58 lines
2.8 KiB
Swift
Raw Normal View History

2020-11-03 23:16:20 -05:00
//
// MarketView.swift
// BlueWallet
//
// Created by Marcos Rodriguez on 11/3/20.
// Copyright © 2020 BlueWallet. All rights reserved.
//
import SwiftUI
import WidgetKit
struct MarketView: View {
2020-11-03 23:16:20 -05:00
var marketData: MarketData = emptyMarketData
2020-11-03 23:16:20 -05:00
var body: some View {
VStack(alignment: .leading, spacing:23 , content: {
VStack(alignment: .leading, spacing: /*@START_MENU_TOKEN@*/nil/*@END_MENU_TOKEN@*/, content: {
Text("Market").font(.headline).foregroundColor(.textColor).bold()
Spacer()
HStack(alignment: .center, spacing: 0, content: {
Text("Next Block").bold().lineLimit(1).font(Font.system(size:11, weight: .medium, design: .default)).foregroundColor(.textColor)
Spacer()
Text(marketData.formattedNextBlock).padding(EdgeInsets(top: 2, leading: 4, bottom: 2, trailing: 4)).lineLimit(1).minimumScaleFactor(0.1).foregroundColor(.widgetBackground).font(Font.system(size:11, weight: .semibold, design: .default)).background(Color(red: 0.29, green: 0.86, blue: 0.73)).overlay(
RoundedRectangle(cornerRadius: 4.0)
.stroke(Color.containerGreen, lineWidth: 4.0))
})
2020-11-03 23:16:20 -05:00
Spacer()
HStack(alignment: .center, spacing: 0, content: {
Text("Sats/\(Currency.getUserPreferredCurrency())").bold().lineLimit(1).font(Font.system(size:11, weight: .medium, design: .default)).foregroundColor(.textColor)
2020-11-03 23:16:20 -05:00
Spacer()
2024-12-12 23:38:41 -04:00
Text( marketData.sats).padding(EdgeInsets(top: 2, leading: 4, bottom: 2, trailing: 4)).lineLimit(1).minimumScaleFactor(0.1).foregroundColor(.widgetBackground).font(Font.system(size:11, weight: .semibold, design: .default)).background(Color(red: 0.97, green: 0.21, blue: 0.38)).overlay(
2020-11-03 23:16:20 -05:00
RoundedRectangle(cornerRadius: 4.0)
.stroke(Color.containerRed, lineWidth: 4.0))
})
Spacer()
HStack(alignment: .center, spacing: 0, content: {
Text("Price").bold().lineLimit(1).font(Font.system(size:11, weight: . medium, design: .default)).foregroundColor(.textColor)
Spacer()
2024-12-12 23:38:41 -04:00
Text( marketData.price).padding(EdgeInsets(top: 2, leading: 4, bottom: 2, trailing: 4)).lineLimit(1).minimumScaleFactor(0.1).foregroundColor(.widgetBackground).font(Font.system(size:11, weight: .semibold, design: .default)).background(Color(red: 0.29, green: 0.86, blue: 0.73)).overlay(
2020-11-03 23:16:20 -05:00
RoundedRectangle(cornerRadius:4.0)
.stroke(Color.containerGreen, lineWidth: 4.0))
})
})
})
}
}
2020-11-03 23:16:20 -05:00
struct MarketView_Previews: PreviewProvider {
static var previews: some View {
MarketView(marketData: MarketData(nextBlock: "26", sats: "9 134", price: "$10,000", rate: 0))
.previewContext(WidgetPreviewContext(family: .systemSmall))
}
}