From 5389fe375953aa03b9446bb5d1e50e96e7e98044 Mon Sep 17 00:00:00 2001 From: Trey t Date: Mon, 9 Feb 2026 17:52:38 -0600 Subject: [PATCH] ui: make Featured Trips carousel scroll edge-to-edge 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 --- SportsTime/Features/Home/Views/HomeView.swift | 4 +++- SportsTime/Features/Home/Views/LoadingTripsView.swift | 3 +++ .../Home/Views/Variants/Classic/HomeContent_Classic.swift | 5 +++-- .../Views/Variants/Classic/HomeContent_ClassicAnimated.swift | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/SportsTime/Features/Home/Views/HomeView.swift b/SportsTime/Features/Home/Views/HomeView.swift index 1d73705..878f32b 100644 --- a/SportsTime/Features/Home/Views/HomeView.swift +++ b/SportsTime/Features/Home/Views/HomeView.swift @@ -189,6 +189,7 @@ struct HomeView: View { .foregroundStyle(Theme.warmOrange) } } + .padding(.horizontal, Theme.Spacing.md) // Horizontal carousel grouped by region ScrollView(.horizontal, showsIndicators: false) { @@ -218,8 +219,8 @@ struct HomeView: View { } } } - .padding(.horizontal, 1) // Prevent clipping } + .contentMargins(.horizontal, Theme.Spacing.md, for: .scrollContent) } } else if let error = suggestedTripsGenerator.error { // Error state @@ -249,6 +250,7 @@ struct HomeView: View { .background(Theme.cardBackground(colorScheme)) .clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium)) } + .padding(.horizontal, Theme.Spacing.md) } } diff --git a/SportsTime/Features/Home/Views/LoadingTripsView.swift b/SportsTime/Features/Home/Views/LoadingTripsView.swift index e8e98fb..056925c 100644 --- a/SportsTime/Features/Home/Views/LoadingTripsView.swift +++ b/SportsTime/Features/Home/Views/LoadingTripsView.swift @@ -20,10 +20,12 @@ struct LoadingTripsView: View { .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) { @@ -33,6 +35,7 @@ struct LoadingTripsView: View { } } } + .contentMargins(.horizontal, Theme.Spacing.md, for: .scrollContent) } } } diff --git a/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_Classic.swift b/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_Classic.swift index 81e52b9..90a1548 100644 --- a/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_Classic.swift +++ b/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_Classic.swift @@ -30,7 +30,6 @@ struct HomeContent_Classic: View { // Suggested Trips suggestedTripsSection - .padding(.horizontal, Theme.Spacing.md) // Saved Trips if !savedTrips.isEmpty { @@ -120,6 +119,7 @@ struct HomeContent_Classic: View { .foregroundStyle(Theme.warmOrange) } } + .padding(.horizontal, Theme.Spacing.md) // Horizontal carousel grouped by region ScrollView(.horizontal, showsIndicators: false) { @@ -149,8 +149,8 @@ struct HomeContent_Classic: View { } } } - .padding(.horizontal, 1) } + .contentMargins(.horizontal, Theme.Spacing.md, for: .scrollContent) } } else if let error = suggestedTripsGenerator.error { // Error state @@ -180,6 +180,7 @@ struct HomeContent_Classic: View { .background(Theme.cardBackground(colorScheme)) .clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium)) } + .padding(.horizontal, Theme.Spacing.md) } } diff --git a/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_ClassicAnimated.swift b/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_ClassicAnimated.swift index 64f9b35..2def6f4 100644 --- a/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_ClassicAnimated.swift +++ b/SportsTime/Features/Home/Views/Variants/Classic/HomeContent_ClassicAnimated.swift @@ -30,7 +30,6 @@ struct HomeContent_ClassicAnimated: View { // Suggested Trips suggestedTripsSection - .padding(.horizontal, Theme.Spacing.md) // Saved Trips if !savedTrips.isEmpty { @@ -119,6 +118,7 @@ struct HomeContent_ClassicAnimated: View { .foregroundStyle(Theme.warmOrange) } } + .padding(.horizontal, Theme.Spacing.md) // Horizontal carousel grouped by region ScrollView(.horizontal, showsIndicators: false) { @@ -148,8 +148,8 @@ struct HomeContent_ClassicAnimated: View { } } } - .padding(.horizontal, 1) } + .contentMargins(.horizontal, Theme.Spacing.md, for: .scrollContent) } } else if let error = suggestedTripsGenerator.error { // Error state @@ -179,6 +179,7 @@ struct HomeContent_ClassicAnimated: View { .background(Theme.cardBackground(colorScheme)) .clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium)) } + .padding(.horizontal, Theme.Spacing.md) } }