Skip to content

Commit

Permalink
Refactor FXIOS-7577 [v121] Fakespot - Replace primary button in Fakes…
Browse files Browse the repository at this point in the history
…potOptInCardView to PrimaryRoundedButton (#16925) (#17237)

(cherry picked from commit 9acf5ac)

Co-authored-by: mingming-ma <[email protected]>
  • Loading branch information
mergify[bot] and mingming-ma authored Nov 9, 2023
1 parent 4aa5e8b commit a1cac8c
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions Client/Frontend/Fakespot/Views/FakespotOptInCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ final class FakespotOptInCardView: UIView, ThemeApplicable {
static let learnMoreInsets = UIEdgeInsets(top: -10, left: 0, bottom: 10, right: 0)
static let termsOfUseButtonTitleFontSize: CGFloat = 13
static let privacyPolicyButtonTitleFontSize: CGFloat = 13
static let mainButtonFontSize: CGFloat = 16
static let mainButtonCornerRadius: CGFloat = 14
static let mainButtonInsets = UIEdgeInsets(top: 12, left: 0, bottom: 12, right: 0)
static let secondaryButtonFontSize: CGFloat = 13
static let contentStackViewSpacing: CGFloat = 12
static let contentStackViewPadding: CGFloat = 16
Expand Down Expand Up @@ -102,15 +99,8 @@ final class FakespotOptInCardView: UIView, ThemeApplicable {
size: UX.privacyPolicyButtonTitleFontSize)
}

private lazy var mainButton: ResizableButton = .build { button in
button.contentHorizontalAlignment = .center
button.buttonEdgeSpacing = 0
button.layer.cornerRadius = UX.mainButtonCornerRadius
button.contentEdgeInsets = UX.mainButtonInsets
private lazy var mainButton: PrimaryRoundedButton = .build { button in
button.addTarget(self, action: #selector(self.didTapMainButton), for: .touchUpInside)
button.titleLabel?.font = DefaultDynamicFontHelper.preferredFont(withTextStyle: .headline,
size: UX.mainButtonFontSize,
weight: .semibold)
}

private lazy var secondaryButton: ResizableButton = .build { button in
Expand Down Expand Up @@ -223,8 +213,11 @@ final class FakespotOptInCardView: UIView, ThemeApplicable {
privacyPolicyButton.setTitle(viewModel.privacyPolicyButtonText, for: .normal)
privacyPolicyButton.accessibilityIdentifier = viewModel.privacyPolicyButtonA11yId

mainButton.setTitle(viewModel.mainButtonText, for: .normal)
mainButton.accessibilityIdentifier = viewModel.mainButtonA11yId
let buttonViewModel = PrimaryRoundedButtonViewModel(
title: viewModel.mainButtonText,
a11yIdentifier: viewModel.mainButtonA11yId
)
mainButton.configure(viewModel: buttonViewModel)

secondaryButton.setTitle(viewModel.secondaryButtonText, for: .normal)
secondaryButton.accessibilityIdentifier = viewModel.secondaryButtonA11yId
Expand All @@ -250,8 +243,7 @@ final class FakespotOptInCardView: UIView, ThemeApplicable {
learnMoreButton.setTitleColor(colors.textAccent, for: .normal)
termsOfUseButton.setTitleColor(colors.textAccent, for: .normal)
privacyPolicyButton.setTitleColor(colors.textAccent, for: .normal)
mainButton.setTitleColor(colors.textInverted, for: .normal)
mainButton.backgroundColor = colors.actionPrimary
mainButton.applyTheme(theme: theme)
secondaryButton.setTitleColor(colors.textAccent, for: .normal)
}
}

0 comments on commit a1cac8c

Please sign in to comment.