Skip to content

Commit

Permalink
chore: stack items to top for long texts dispay (#264)
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Yves Lapersonne <[email protected]>
  • Loading branch information
pylapp committed Feb 4, 2025
1 parent aed6811 commit 48c1a07
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"originHash" : "2607da8610cd896469838f47a63558192b1b0c03641b836042ba28782dedbab2",
"pins" : [
{
"identity" : "accessibility-statement-lib-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Orange-OpenSource/accessibility-statement-lib-ios.git",
"state" : {
"revision" : "480bf4629b951e459308379030f1ca0ce28a0987",
"version" : "1.3.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state" : {
"revision" : "42a086182681cf661f5c47c9b7dc3931de18c6d7",
"version" : "1.17.6"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "0687f71944021d616d34d922343dcef086855920",
"version" : "600.0.1"
}
}
],
"version" : 3
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct OUDSCheckboxLabel: View {
// MARK: - Body

var body: some View {
HStack(spacing: theme.listItem.listItemSpaceColumnGap) {
HStack(alignment: .top, spacing: theme.listItem.listItemSpaceColumnGap) {
if isInversed {
icon()
texts()
Expand Down Expand Up @@ -76,11 +76,16 @@ struct OUDSCheckboxLabel: View {
@ViewBuilder
private func icon() -> some View {
if let icon = items.icon {
icon
.resizable()
.renderingMode(.template)
.foregroundStyle(iconColor)
.frame(width: theme.listItem.listItemSizeIcon, height: theme.listItem.listItemSizeIcon)
HStack(alignment: .center, spacing: 0) {
icon
.resizable()
.renderingMode(.template)
.foregroundStyle(iconColor)
.frame(width: theme.listItem.listItemSizeIcon,
height: theme.listItem.listItemSizeIcon)
}
.frame(maxHeight: theme.checkRadio.checkRadioSizeMaxHeightAssetsContainer,
alignment: .center)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@ struct OUDSCheckboxLabeledStyle: ButtonStyle {
// MARK: - Body

func makeBody(configuration: Configuration) -> some View {
HStack(alignment: .center, spacing: theme.listItem.listItemSpaceColumnGap) {
if isInversed {
OUDSCheckboxLabel(internalState: internalState(isPressed: configuration.isPressed),
items: items,
isInversed: true)
HStack(alignment: .top, spacing: theme.listItem.listItemSpaceColumnGap) {
HStack(alignment: .center, spacing: theme.listItem.listItemSpaceColumnGap) {
if isInversed {
OUDSCheckboxLabel(internalState: internalState(isPressed: configuration.isPressed),
items: items,
isInversed: true)

OUDSCheckboxSelectorButton(internalState: internalState(isPressed: configuration.isPressed),
selectorState: selectorState,
isError: items.isError)
} else {
OUDSCheckboxSelectorButton(internalState: internalState(isPressed: configuration.isPressed),
selectorState: selectorState,
isError: items.isError)
OUDSCheckboxSelectorButton(internalState: internalState(isPressed: configuration.isPressed),
selectorState: selectorState,
isError: items.isError)
} else {
OUDSCheckboxSelectorButton(internalState: internalState(isPressed: configuration.isPressed),
selectorState: selectorState,
isError: items.isError)

OUDSCheckboxLabel(internalState: internalState(isPressed: configuration.isPressed),
items: items,
isInversed: false)
}
OUDSCheckboxLabel(internalState: internalState(isPressed: configuration.isPressed),
items: items,
isInversed: false)
}
}.frame(maxHeight: theme.checkRadio.checkRadioSizeMaxHeightAssetsContainer,
alignment: .center)
}
.padding(.all, theme.listItem.listItemSpaceInset)
.oudsDivider(show: items.divider)
Expand Down

0 comments on commit 48c1a07

Please sign in to comment.