Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#630] Update cards to align buttons when text is too long #641

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//

import SwiftUI
import Flow

///
/// <a href="https://system.design.orange.com/0c1af118d/p/66bac5-cards/b/1591fb" target="_blank">ODS Card</a>.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//

import SwiftUI
import Flow

///
/// <a href="https://system.design.orange.com/0c1af118d/p/66bac5-cards/b/1591fb" target="_blank">ODS Card</a>.
Expand Down Expand Up @@ -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()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//

import SwiftUI
import Flow

///
/// <a href="https://system.design.orange.com/0c1af118d/p/66bac5-cards/b/1591fb" target="_blank">ODS Card</a>.
Expand Down Expand Up @@ -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()
}
}
}
}
Expand Down
Loading