mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-24 23:38:57 +01:00
Update CompactPriceView.swift
This commit is contained in:
parent
3023b720ba
commit
bd4eb77c0c
1 changed files with 28 additions and 10 deletions
|
@ -14,19 +14,20 @@ struct CompactPriceView: View {
|
||||||
Text(price)
|
Text(price)
|
||||||
.font(.title)
|
.font(.title)
|
||||||
.bold()
|
.bold()
|
||||||
.foregroundColor(priceTextColor)
|
|
||||||
.shadow(color: Color.black.opacity(0.2), radius: 1, x: 0, y: 1)
|
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.dynamicTypeSize(.large ... .accessibility5)
|
.dynamicTypeSize(.large ... .accessibility5)
|
||||||
.accessibilityLabel("Bitcoin price: \(price)")
|
.accessibilityLabel("Bitcoin price: \(price)")
|
||||||
|
|
||||||
VStack(alignment: .center, spacing: 8) {
|
VStack(alignment: .center, spacing: 8) {
|
||||||
Text(code)
|
Text(code)
|
||||||
|
.shadow(color: shadowColor(), radius: 1, x: 0, y: 1)
|
||||||
Text(lastUpdated)
|
Text(lastUpdated)
|
||||||
|
.shadow(color: shadowColor(), radius: 1, x: 0, y: 1)
|
||||||
Text(dataSource)
|
Text(dataSource)
|
||||||
|
.shadow(color: shadowColor(), radius: 1, x: 0, y: 1)
|
||||||
}
|
}
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundColor(systemButtonTextColor)
|
.foregroundColor(.secondary)
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.accessibilityElement(children: .combine)
|
.accessibilityElement(children: .combine)
|
||||||
}
|
}
|
||||||
|
@ -34,13 +35,30 @@ struct CompactPriceView: View {
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adaptive color for the price text using system built-in colors
|
private func shadowColor() -> Color {
|
||||||
var priceTextColor: Color {
|
colorScheme == .dark ? .white.opacity(0.2) : .black.opacity(0.2)
|
||||||
colorScheme == .dark ? .cyan : .blue
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the system button text color for the secondary text
|
|
||||||
var systemButtonTextColor: Color {
|
@available(iOS 15.0, *)
|
||||||
Color.accentColor
|
struct CompactPriceView_Previews: PreviewProvider {
|
||||||
|
static var previews: some View {
|
||||||
|
ZStack {
|
||||||
|
// Example vibrant background
|
||||||
|
LinearGradient(
|
||||||
|
gradient: Gradient(colors: [.blue, .purple]),
|
||||||
|
startPoint: .top,
|
||||||
|
endPoint: .bottom
|
||||||
|
)
|
||||||
|
.ignoresSafeArea()
|
||||||
|
|
||||||
|
CompactPriceView(
|
||||||
|
price: "$50,000",
|
||||||
|
lastUpdated: "Last updated: Oct 10, 2023",
|
||||||
|
code: "BTC",
|
||||||
|
dataSource: "Data source: CoinDesk"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue