Use contentMargins on horizontal ScrollView so cards start inset but scroll to screen edges. Pad headers and error states individually. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.3 KiB
Swift
50 lines
1.3 KiB
Swift
//
|
|
// LoadingTripsView.swift
|
|
// SportsTime
|
|
//
|
|
// Loading state for suggested trips carousel using skeleton placeholders.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct LoadingTripsView: View {
|
|
let message: String
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: Theme.Spacing.sm) {
|
|
// Header
|
|
HStack {
|
|
Text("Featured Trips")
|
|
.font(.title2)
|
|
.foregroundStyle(Theme.textPrimary(colorScheme))
|
|
Spacer()
|
|
}
|
|
.padding(.horizontal, Theme.Spacing.md)
|
|
|
|
// Loading indicator with message
|
|
LoadingSpinner(size: .small, label: message)
|
|
.padding(.vertical, Theme.Spacing.xs)
|
|
.padding(.horizontal, Theme.Spacing.md)
|
|
|
|
// Placeholder cards
|
|
ScrollView(.horizontal, showsIndicators: false) {
|
|
HStack(spacing: Theme.Spacing.md) {
|
|
ForEach(0..<3, id: \.self) { _ in
|
|
LoadingPlaceholder.card
|
|
}
|
|
}
|
|
}
|
|
.contentMargins(.horizontal, Theme.Spacing.md, for: .scrollContent)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
VStack {
|
|
LoadingTripsView(message: "Loading trips...")
|
|
.padding()
|
|
}
|
|
.themedBackground()
|
|
}
|