Skip to content

Commit

Permalink
Rename to default and make it work better
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdholtz committed Feb 13, 2025
1 parent ab1be02 commit d394e84
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,16 @@ struct StackComponentView: View {
}
.padding(style.padding)
.padding(additionalPadding)
.scrollableIfEnabled(
style.dimension,
enabled: style.scrollable ?? self.isScrollableByDefault
)
.shape(border: nil,
shape: style.shape,
background: style.backgroundStyle,
uiConfigProvider: self.viewModel.uiConfigProvider)
.apply(badge: style.badge, border: style.border, shadow: style.shadow, shape: style.shape)
.padding(style.margin)
.scrollableIfEnabled(
style.dimension,
enabled: style.scrollable ?? self.isScrollableByDefault
)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ struct StackComponentStyle {

self.scrollable = overflow.flatMap({ overflow in
switch overflow {
case .none:
case .default:
return false
case .scroll:
return true
}
}) ?? false
})
}

var vstackStrategy: StackStrategy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ private enum Template1Preview {
stack: packageStack
)

static let bodyStack = PaywallComponent.StackComponent(
components: [
.text(body),
.package(package)
],
dimension: .vertical(.center, .start),
size: .init(width: .fill, height: .fit),
spacing: 30,
backgroundColor: nil
)

static let purchaseButton = PaywallComponent.PurchaseButtonComponent(
stack: .init(
components: [
Expand All @@ -117,10 +128,11 @@ private enum Template1Preview {
static let contentStack = PaywallComponent.StackComponent(
components: [
.text(title),
.text(body),
.package(package),
.stack(bodyStack),
.purchaseButton(purchaseButton)
],
dimension: .vertical(.center, .spaceEvenly),
size: .init(width: .fill, height: .fill),
spacing: 30,
backgroundColor: nil,
margin: .init(top: 0,
Expand All @@ -134,8 +146,9 @@ private enum Template1Preview {
.image(catImage),
.stack(contentStack)
],
spacing: 20,
backgroundColor: nil
dimension: .vertical(.center, .start),
size: .init(width: .fill, height: .fill),
spacing: 0
)

static let paywallComponents: Offering.PaywallComponents = .init(
Expand All @@ -161,7 +174,8 @@ private enum Template1Preview {
stack: .init(
components: [
.stack(stack)
]
],
overflow: .default
),
stickyFooter: nil,
background: .color(.init(
Expand Down
2 changes: 1 addition & 1 deletion Sources/Paywalls/Components/PaywallStackComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public extension PaywallComponent {
final class StackComponent: PaywallComponentBase {

public enum Overflow: PaywallComponentBase {
case none
case `default`
case scroll
}

Expand Down

0 comments on commit d394e84

Please sign in to comment.