Skip to content

Commit

Permalink
rename parentShape -> stackShape, typos
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkVillacampa committed Dec 16, 2024
1 parent 692fd10 commit e9c2afb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class StackComponentViewModel {

private let component: PaywallComponent.StackComponent
private let presentedOverrides: PresentedOverrides<PresentedStackPartial>?
let badgeTextViewModel: TextComponentViewModel?

let badgeTextViewModel: TextComponentViewModel?
let viewModels: [PaywallComponentViewModel]

init(
Expand Down Expand Up @@ -151,7 +151,7 @@ struct StackComponentStyle {
self.shape = shape?.shape
self.border = border?.border
self.shadow = shadow?.shadow
self.badge = badge?.badge(parentShape: self.shape)
self.badge = badge?.badge(stackShape: self.shape)
}

var vstackStrategy: StackStrategy {
Expand Down Expand Up @@ -235,7 +235,7 @@ private extension PaywallComponent.Shadow {
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
private extension PaywallComponent.Badge {

func badge(parentShape: ShapeModifier.Shape?) -> BadgeModifier.BadgeInfo? {
func badge(stackShape: ShapeModifier.Shape?) -> BadgeModifier.BadgeInfo? {
BadgeModifier.BadgeInfo(
style: self.style,
alignment: self.alignment,
Expand All @@ -249,7 +249,7 @@ private extension PaywallComponent.Badge {
horizontalAlignment: self.horizontalAlignment,
color: self.color,
backgroundColor: self.backgroundColor,
parentShape: parentShape
stackShape: stackShape
)
}

Expand Down
14 changes: 7 additions & 7 deletions RevenueCatUI/Templates/V2/ViewHelpers/BadgeModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct BadgeModifier: ViewModifier {
let horizontalAlignment: PaywallComponent.HorizontalAlignment
let color: PaywallComponent.ColorScheme
let backgroundColor: PaywallComponent.ColorScheme
let parentShape: ShapeModifier.Shape?
let stackShape: ShapeModifier.Shape?
}

func body(content: Content) -> some View {
Expand Down Expand Up @@ -234,36 +234,36 @@ fileprivate extension View {
bottomRight: corners?.bottomRight))
case .topLeading:
return .rectangle(.init(
topLeft: radiusInfo(shape: badge.parentShape)?.topLeft,
topLeft: radiusInfo(shape: badge.stackShape)?.topLeft,
topRight: 0,
bottomLeft: 0,
bottomRight: corners?.bottomRight))
case .topTrailing:
return .rectangle(.init(
topLeft: 0.0,
topRight: radiusInfo(shape: badge.parentShape)?.topRight,
topRight: radiusInfo(shape: badge.stackShape)?.topRight,
bottomLeft: corners?.bottomLeft,
bottomRight: 0))
case .bottomLeading:
return .rectangle(.init(
topLeft: 0.0,
topRight: corners?.topRight,
bottomLeft: radiusInfo(shape: badge.parentShape)?.bottomLeft,
bottomLeft: radiusInfo(shape: badge.stackShape)?.bottomLeft,
bottomRight: 0))
case .bottomTrailing:
return .rectangle(.init(
topLeft: corners?.topLeft,
topRight: 0,
bottomLeft: 0,
bottomRight: radiusInfo(shape: badge.parentShape)?.bottomRight))
bottomRight: radiusInfo(shape: badge.stackShape)?.bottomRight))
}
}
case .nested, .overlaid:
return badge.shape
}
}

// Helper to extract the RadiusInfo from a rectable shape
// Helper to extract the RadiusInfo from a rectanle shape
private func radiusInfo(shape: ShapeModifier.Shape?) -> ShapeModifier.RadiusInfo? {
switch shape {
case .rectangle(let radius):
Expand Down Expand Up @@ -354,7 +354,7 @@ private func badge(style: PaywallComponent.BadgeStyle, alignment: PaywallCompone
horizontalAlignment: .center,
color: .init(light: .hex("#000000")),
backgroundColor: .init(light: .hex("#FA8072")),
parentShape: .rectangle(.init(topLeft: 12.0, topRight: 12, bottomLeft: 12, bottomRight: 12))
stackShape: .rectangle(.init(topLeft: 12.0, topRight: 12, bottomLeft: 12, bottomRight: 12))
),
// swiftlint:disable:next force_try
textComponentViewModel: try! TextComponentViewModel(
Expand Down

0 comments on commit e9c2afb

Please sign in to comment.