Skip to content

Commit

Permalink
Clean up some Prelude operators in PostCampaignPledgeRewardsSummaryCell
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-at-kickstarter committed May 8, 2024
1 parent e9ce5d6 commit b162b61
Showing 1 changed file with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ final class PostCampaignPledgeRewardsSummaryCell: UITableViewCell, ValueCell {
override func bindStyles() {
super.bindStyles()

_ = self
|> \.selectionStyle .~ .none
|> \.separatorInset .~ .init(leftRight: CheckoutConstants.PledgeView.Inset.leftRight)
self.selectionStyle = .none
self.separatorInset = UIEdgeInsets(leftRight: CheckoutConstants.PledgeView.Inset.leftRight)

_ = self.amountLabel
|> UILabel.lens.contentHuggingPriority(for: .horizontal) .~ .required
|> \.adjustsFontForContentSizeCategory .~ true
self.amountLabel.setContentHuggingPriority(.required, for: .horizontal)

self.amountLabel.adjustsFontForContentSizeCategory = true

_ = self.rootStackView
|> rootStackViewStyle(self.traitCollection.preferredContentSizeCategory > .accessibilityLarge)
Expand Down Expand Up @@ -82,10 +81,11 @@ final class PostCampaignPledgeRewardsSummaryCell: UITableViewCell, ValueCell {
// MARK: - Styles

private let titleLabelStyle: LabelStyle = { label in
label
|> \.font .~ UIFont.ksr_subhead().bolded
|> \.textColor .~ .ksr_support_400
|> \.numberOfLines .~ 0
label.font = UIFont.ksr_subhead().bolded
label.textColor = UIColor.ksr_support_400
label.numberOfLines = 0

return label
}

private func rootStackViewStyle(_ isAccessibilityCategory: Bool) -> (StackViewStyle) {
Expand All @@ -95,16 +95,17 @@ private func rootStackViewStyle(_ isAccessibilityCategory: Bool) -> (StackViewSt
let spacing: CGFloat = (isAccessibilityCategory ? Styles.grid(1) : 0)

return { (stackView: UIStackView) in
stackView
|> \.insetsLayoutMarginsFromSafeArea .~ false
|> \.alignment .~ alignment
|> \.axis .~ axis
|> \.distribution .~ distribution
|> \.spacing .~ spacing
|> \.isLayoutMarginsRelativeArrangement .~ true
|> \.layoutMargins .~ .init(
topBottom: Styles.grid(3),
leftRight: CheckoutConstants.PledgeView.Inset.leftRight
)
stackView.insetsLayoutMarginsFromSafeArea = false
stackView.alignment = alignment
stackView.axis = axis
stackView.distribution = distribution
stackView.spacing = spacing
stackView.isLayoutMarginsRelativeArrangement = true
stackView.layoutMargins = UIEdgeInsets(
topBottom: Styles.grid(3),
leftRight: CheckoutConstants.PledgeView.Inset.leftRight
)

return stackView
}
}

0 comments on commit b162b61

Please sign in to comment.