Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Open Dev] Fix PayPal Demo UI #1438

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions Demo/Application/Features/PayPalWebCheckoutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
lazy var emailTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "[email protected]"
textField.textAlignment = .right
textField.backgroundColor = .systemBackground
textField.keyboardType = .emailAddress
return textField
}()

lazy var emailStackView: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [emailLabel, emailTextField])
stackView.distribution = .fillProportionally
return stackView
}()

lazy var countryCodeLabel: UILabel = {
let label = UILabel()
label.text = "Country Code:"
Expand All @@ -33,11 +41,18 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
lazy var countryCodeTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "1"
textField.textAlignment = .right
textField.backgroundColor = .systemBackground
textField.keyboardType = .phonePad
return textField
}()

lazy var countryCodeStackView: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [countryCodeLabel, countryCodeTextField])
stackView.distribution = .fillEqually
return stackView
}()

lazy var nationalNumberLabel: UILabel = {
let label = UILabel()
label.text = "National Number:"
Expand All @@ -47,11 +62,18 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
lazy var nationalNumberTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "000-000-000"
textField.textAlignment = .right
textField.backgroundColor = .systemBackground
textField.keyboardType = .phonePad
return textField
}()

lazy var nationalNumberStackView: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [nationalNumberLabel, nationalNumberTextField])
stackView.distribution = .fillEqually
return stackView
}()

lazy var payLaterToggleLabel: UILabel = {
let label = UILabel()
label.text = "Offer Pay Later"
Expand Down Expand Up @@ -80,7 +102,7 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
let rbaDataToggle = UISwitch()

override func viewDidLoad() {
super.heightConstraint = 350
super.heightConstraint = 400
super.viewDidLoad()
}

Expand All @@ -94,16 +116,18 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
UIStackView(arrangedSubviews: [newPayPalCheckoutToggleLabel, newPayPalCheckoutToggle]),
payPalCheckoutButton
])
oneTimeCheckoutStackView.spacing = 12
let vaultStackView = buttonsStackView(label: "Vault", views: [
UIStackView(arrangedSubviews: [rbaDataToggleLabel, rbaDataToggle]),
payPalVaultButton,
payPalAppSwitchButton
])
vaultStackView.spacing = 12

let stackView = UIStackView(arrangedSubviews: [
UIStackView(arrangedSubviews: [emailLabel, emailTextField]),
UIStackView(arrangedSubviews: [countryCodeLabel, countryCodeTextField]),
UIStackView(arrangedSubviews: [nationalNumberLabel, nationalNumberTextField]),
emailStackView,
countryCodeStackView,
nationalNumberStackView,
oneTimeCheckoutStackView,
vaultStackView
])
Expand Down