From ca742eb73fad48d253960f5bc84b3f0806cab2f6 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 31 Dec 2025 09:57:45 -0600 Subject: [PATCH] Signed-off-by: Matt Bruce --- .../Blackjack/Views/Table/CardStackView.swift | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/Blackjack/Blackjack/Views/Table/CardStackView.swift b/Blackjack/Blackjack/Views/Table/CardStackView.swift index cef4ea7..af0c525 100644 --- a/Blackjack/Blackjack/Views/Table/CardStackView.swift +++ b/Blackjack/Blackjack/Views/Table/CardStackView.swift @@ -30,22 +30,34 @@ struct CardStackView: View { /// This prevents width changes during dealing by pre-allocating placeholder space. let minimumCardSlots: Int + /// Whether placeholders should use staggered (overlapped) layout like dealt cards. + /// - `true`: Placeholders overlap using `cardSpacing` (use for bordered containers like player hand) + /// - `false`: Placeholders side-by-side (use for borderless containers like dealer hand) + let staggeredPlaceholders: Bool + /// Number of additional placeholders needed to reach minimum slots. private var placeholdersNeeded: Int { max(0, minimumCardSlots - cards.count) } + /// Spacing to use for empty placeholder state + private var placeholderSpacing: CGFloat { + staggeredPlaceholders ? cardSpacing : Design.Spacing.small + } + /// Scaled animation duration based on dealing speed. private var animationDuration: Double { Design.Animation.springDuration * dealingSpeed } var body: some View { - HStack(spacing: cards.isEmpty && placeholdersNeeded > 0 ? Design.Spacing.small : cardSpacing) { + // Use staggered or side-by-side spacing based on configuration + HStack(spacing: cards.isEmpty && placeholdersNeeded > 0 ? placeholderSpacing : cardSpacing) { if cards.isEmpty && placeholdersNeeded > 0 { // Show placeholders when empty - ForEach(0..