From 67b41368aebbdcd670365bdc242375f9f44ed4ef Mon Sep 17 00:00:00 2001 From: Ludovic PINEL Date: Thu, 25 Jan 2024 11:29:26 +0100 Subject: [PATCH] Update flow --- .../Components/Banner/ODSBanner.swift | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Banner/ODSBanner.swift b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Banner/ODSBanner.swift index 570a47a0..f71324da 100644 --- a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Banner/ODSBanner.swift +++ b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Banner/ODSBanner.swift @@ -12,6 +12,7 @@ // import SwiftUI +import Flow /// A banner displays an important message which requires an /// action to be dismissed. @@ -105,7 +106,7 @@ public struct ODSBanner: View { .padding(.bottom, firstButton == nil ? ODSSpacing.m : ODSSpacing.none) .padding(.horizontal, ODSSpacing.m) - bottomButtons() + buttons() } Divider() @@ -117,13 +118,18 @@ public struct ODSBanner: View { // ============= @ViewBuilder - private func bottomButtons() -> some View { + private func buttons() -> some View { if let firstButton = firstButton { - HStack(spacing: ODSSpacing.none) { - firstButton() - .odsEmphasisButtonStyle(emphasis: .lowest) - secondButton?() - .odsEmphasisButtonStyle(emphasis: .lowest) + if #available(iOS 16.0, *) { + HFlow(alignment: .top, spacing: ODSSpacing.none) { + firstButton().odsEmphasisButtonStyle(emphasis: .lowest) + secondButton?().odsEmphasisButtonStyle(emphasis: .lowest) + } + } else { + HStack(alignment: .center, spacing: ODSSpacing.none) { + firstButton().odsEmphasisButtonStyle(emphasis: .lowest) + secondButton?().odsEmphasisButtonStyle(emphasis: .lowest) + } } } }