Skip to content

Commit

Permalink
[#642] Update Banners to align buttons when text is too long (#645)
Browse files Browse the repository at this point in the history
* Update flow

* Update chagelog

Reviewed-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
ludovic35 authored Jan 25, 2024
1 parent b608665 commit 13d2011
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ 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))
- [SDK] Update Banners to align buttons when text is too long ([#642](https://github.com/Orange-OpenSource/ods-ios/issues/642))
- [SDK] Update Cards to align buttons when text is too long ([#630](https://github.com/Orange-OpenSource/ods-ios/issues/630))
- [Tooling] Upgrate to xcode 15 ([#638](https://github.com/Orange-OpenSource/ods-ios/issues/638))
- [DemoApp/SDK] ODSSmallCard and GridOfSmallCards a11i issue if accessible text sizes in use ([#598](https://github.com/Orange-OpenSource/ods-ios/issues/598))
- [Tooling] Upgrade to Xcode 15 ([#638](https://github.com/Orange-OpenSource/ods-ios/issues/638))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//

import SwiftUI
import Flow

/// A banner displays an important message which requires an
/// action to be dismissed.
Expand Down Expand Up @@ -105,7 +106,7 @@ public struct ODSBanner: View {
.padding(.bottom, firstButton == nil ? ODSSpacing.m : ODSSpacing.none)
.padding(.horizontal, ODSSpacing.m)

bottomButtons()
buttons()
}

Divider()
Expand All @@ -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)
}
}
}
}
Expand Down

0 comments on commit 13d2011

Please sign in to comment.