49 lines
1.7 KiB
Swift
49 lines
1.7 KiB
Swift
import SwiftUI
|
|
|
|
/// Reusable wrapper that applies the system overview stats card styling to a header view.
|
|
struct StatsHeaderContainer<Content: View>: View {
|
|
private let content: Content
|
|
|
|
init(@ViewBuilder content: () -> Content) {
|
|
self.content = content()
|
|
}
|
|
|
|
var body: some View {
|
|
Group {
|
|
if #available(iOS 26.0, *) {
|
|
card
|
|
.glassEffect(.regular, in: .rect(cornerRadius: 20))
|
|
.padding(.horizontal, 16)
|
|
.padding(.top, 12)
|
|
.padding(.bottom, 12)
|
|
} else {
|
|
card
|
|
.padding(.horizontal, 16)
|
|
.padding(.top, 20)
|
|
.padding(.bottom, 16)
|
|
.background(Color(.systemGroupedBackground))
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
|
.strokeBorder(.white.opacity(0.15))
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
private var card: some View {
|
|
content
|
|
.padding(.vertical, 18)
|
|
.padding(.horizontal, 20)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.background(
|
|
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
|
.fill(Color(red: 81 / 255, green: 144 / 255, blue: 152 / 255).opacity(0.12))
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
|
.stroke(Color(.separator).opacity(0.18), lineWidth: 1)
|
|
)
|
|
)
|
|
.clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
|
|
}
|
|
}
|