36 lines
1.5 KiB
Swift
36 lines
1.5 KiB
Swift
import SwiftUI
|
|
|
|
/// Cards per `DESIGN (1).md` → Components → Cards: "White backgrounds with
|
|
/// 1px borders in #E2E8F0. No shadows. Content within cards should follow
|
|
/// the 24px internal padding rule." And → Shapes: 0px radius everywhere.
|
|
struct ZenithCardModifier: ViewModifier {
|
|
var padding: CGFloat = ZenithSpacing.cardPadding
|
|
|
|
func body(content: Content) -> some View {
|
|
content
|
|
.padding(padding)
|
|
.background(Color.zenithSurface)
|
|
.overlay(Rectangle().strokeBorder(Color.zenithBorder, lineWidth: 1))
|
|
// Deliberately no `.cornerRadius` and no `.shadow` — both are
|
|
// explicitly rejected by the design system ("rejects traditional
|
|
// shadows and depth", "0px radius" everywhere).
|
|
}
|
|
}
|
|
|
|
extension View {
|
|
func zenithCard(padding: CGFloat = ZenithSpacing.cardPadding) -> some View {
|
|
modifier(ZenithCardModifier(padding: padding))
|
|
}
|
|
|
|
/// Strips the default iOS `List`/`Form` chrome (rounded row groups,
|
|
/// system grey background, inset grouping) toward the flat,
|
|
/// bordered-card look the rest of this design system uses. Apply to a
|
|
/// `List`/`Form`; still combine with `.listRowBackground(Color.zenithSurface)`
|
|
/// and `.listRowSeparatorTint(Color.zenithBorder)` on individual rows if
|
|
/// you want row separators to match instead of disappearing.
|
|
func zenithListBackground() -> some View {
|
|
scrollContentBackground(.hidden)
|
|
.background(Color.zenithBg)
|
|
}
|
|
}
|