From 788e6226aae4ed49f38d584491bf81f2a8886240 Mon Sep 17 00:00:00 2001 From: Ludovic PINEL Date: Thu, 25 Jan 2024 10:50:00 +0100 Subject: [PATCH 1/2] Update all cards with the same Flow --- .../Components/Cards/ODSCardHorizontal.swift | 21 +++++++++++-------- .../Cards/ODSCardVerticalHeaderFirst.swift | 19 ++++++++++------- .../Cards/ODSCardVerticalImageFirst.swift | 19 ++++++++++------- 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardHorizontal.swift b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardHorizontal.swift index ee7f6317..9e946686 100644 --- a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardHorizontal.swift +++ b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardHorizontal.swift @@ -12,6 +12,7 @@ // import SwiftUI +import Flow /// /// ODS Card. @@ -139,7 +140,7 @@ public struct ODSCardHorizontal: View { public var body: some View { - VStack(spacing: ODSSpacing.none) { + VStack(alignment: .leading, spacing: ODSSpacing.none) { HStack(alignment: .center, spacing: ODSSpacing.none) { if case .leading = imagePosition { image @@ -192,14 +193,16 @@ public struct ODSCardHorizontal: View { if dividerEnabled { Divider() } - - HStack(alignment: .center, spacing: ODSSpacing.none) { - firstButton() - .odsEmphasisButtonStyle(emphasis: .lowest) - secondButton?() - .odsEmphasisButtonStyle(emphasis: .lowest) - - Spacer() + 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) + } } } } diff --git a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalHeaderFirst.swift b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalHeaderFirst.swift index 9026c926..4ed26b6e 100644 --- a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalHeaderFirst.swift +++ b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalHeaderFirst.swift @@ -12,6 +12,7 @@ // import SwiftUI +import Flow /// /// ODS Card. @@ -173,13 +174,17 @@ public struct ODSCardVerticalHeaderFirst: View { @ViewBuilder private func buttons() -> some View { if let firstButton = firstButton { - HStack(alignment: .center, spacing: ODSSpacing.none) { - firstButton() - .odsEmphasisButtonStyle(emphasis: .lowest) - secondButton?() - .odsEmphasisButtonStyle(emphasis: .lowest) - - Spacer() + 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) + Spacer() + } } } } diff --git a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalImageFirst.swift b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalImageFirst.swift index 921a2476..bd9e7c1d 100644 --- a/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalImageFirst.swift +++ b/OrangeDesignSystem/Sources/OrangeDesignSystem/Components/Cards/ODSCardVerticalImageFirst.swift @@ -12,6 +12,7 @@ // import SwiftUI +import Flow /// /// ODS Card. @@ -145,13 +146,17 @@ public struct ODSCardVerticalImageFirst: View { @ViewBuilder private func buttons() -> some View { if let firstButton = firstButton { - HStack(alignment: .center, spacing: ODSSpacing.none) { - firstButton() - .odsEmphasisButtonStyle(emphasis: .lowest) - secondButton?() - .odsEmphasisButtonStyle(emphasis: .lowest) - - Spacer() + 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) + Spacer() + } } } } From 9c762fd91e658ef3cefd730fc877e87196eb51bb Mon Sep 17 00:00:00 2001 From: Ludovic PINEL Date: Thu, 25 Jan 2024 10:55:45 +0100 Subject: [PATCH 2/2] Update chagelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d4ecc25..512c8b13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased](https://github.com/Orange-OpenSource/ods-ios/compare/0.16.0...qualif) +- [SDK] Update cards to align buttons when text is too long ([#630](https://github.com/Orange-OpenSource/ods-ios/issues/6380)) - [Tooling] Upgrate to xcode 15 ([#638](https://github.com/Orange-OpenSource/ods-ios/issues/638)) - [Tooling] Upgrade tools versions and internal librairies ([#639](https://github.com/Orange-OpenSource/ods-ios/issues/639)) - [Docs] Update documentation with illustration ([#602](https://github.com/Orange-OpenSource/ods-ios/issues/602))