77 lines
2.3 KiB
Swift
77 lines
2.3 KiB
Swift
import SwiftUI
|
|
|
|
struct GoalShareCardView: View {
|
|
let name: String
|
|
let progress: Double
|
|
let currentValue: Decimal
|
|
let targetValue: Decimal
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 16) {
|
|
HStack {
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text("Goal Progress")
|
|
.font(.caption.weight(.semibold))
|
|
.foregroundColor(.white.opacity(0.8))
|
|
Text(name)
|
|
.font(.title2.weight(.bold))
|
|
.foregroundColor(.white)
|
|
}
|
|
Spacer()
|
|
Image(systemName: "sparkles")
|
|
.font(.title2)
|
|
.foregroundColor(.white.opacity(0.9))
|
|
}
|
|
|
|
GoalProgressBar(
|
|
progress: progress,
|
|
tint: .white.opacity(0.9),
|
|
background: .white.opacity(0.2),
|
|
iconName: "sparkles",
|
|
iconColor: .white
|
|
)
|
|
.frame(height: 10)
|
|
|
|
HStack {
|
|
Text(currentValue.currencyString)
|
|
.font(.headline)
|
|
.foregroundColor(.white)
|
|
Spacer()
|
|
Text("of \(targetValue.currencyString)")
|
|
.font(.subheadline.weight(.medium))
|
|
.foregroundColor(.white.opacity(0.8))
|
|
}
|
|
|
|
HStack {
|
|
Image(systemName: "arrow.up.right")
|
|
Text("Track yours in Portfolio Journal")
|
|
}
|
|
.font(.caption.weight(.semibold))
|
|
.foregroundColor(.white.opacity(0.85))
|
|
}
|
|
.padding(24)
|
|
.frame(width: 320, height: 220)
|
|
.background(
|
|
LinearGradient(
|
|
colors: [Color.appPrimary, Color.appSecondary],
|
|
startPoint: .topLeading,
|
|
endPoint: .bottomTrailing
|
|
)
|
|
)
|
|
.clipShape(RoundedRectangle(cornerRadius: 24, style: .continuous))
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 24, style: .continuous)
|
|
.stroke(Color.white.opacity(0.2), lineWidth: 1)
|
|
)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
GoalShareCardView(
|
|
name: "1M Goal",
|
|
progress: 0.42,
|
|
currentValue: 420_000,
|
|
targetValue: 1_000_000
|
|
)
|
|
}
|