39 lines
1.2 KiB
Swift
39 lines
1.2 KiB
Swift
import SwiftUI
|
|
|
|
struct MetricCard: View {
|
|
let title: String
|
|
let value: String
|
|
let icon: String
|
|
let color: Color
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 16) {
|
|
HStack(spacing: 12) {
|
|
// Icon
|
|
Image(systemName: icon)
|
|
.font(.system(size: 24))
|
|
.foregroundColor(color)
|
|
.frame(width: 32, height: 32)
|
|
.background(
|
|
Circle()
|
|
.fill(color.opacity(0.1))
|
|
)
|
|
|
|
VStack(alignment: .leading, spacing: 8) {
|
|
Text(title)
|
|
.font(.subheadline)
|
|
.foregroundColor(.secondary)
|
|
Text(value)
|
|
.font(.system(size: 24, weight: .bold, design: .rounded))
|
|
.foregroundColor(.primary)
|
|
}
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding()
|
|
.background(Color(.controlBackgroundColor))
|
|
.cornerRadius(10)
|
|
.shadow(radius: 2)
|
|
}
|
|
}
|