-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NT-1366] Add-ons Selection Navigation (#1243)
* Navigate to add-ons selection * Actually stage all the files * Put import back * [NT-1366] Add header UI to add-ons selection view (#1244) * Add basic header view with label * Blend background color
- Loading branch information
1 parent
49662f5
commit e0c901f
Showing
9 changed files
with
186 additions
and
2 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
Kickstarter-iOS/Views/Controllers/RewardAddOnSelectionViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import Foundation | ||
import Library | ||
import Prelude | ||
import UIKit | ||
|
||
final class RewardAddOnSelectionViewController: UITableViewController { | ||
// MARK: - Properties | ||
|
||
public lazy var headerLabel: UILabel = UILabel(frame: .zero) | ||
public lazy var headerView: UIView = UIView(frame: .zero) | ||
public lazy var headerRootStackView: UIStackView = UIStackView(frame: .zero) | ||
|
||
// MARK: - Lifecycle | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
self.configureHeaderView() | ||
|
||
self.navigationItem.title = localizedString( | ||
key: "Edit_reward", | ||
defaultValue: "Edit reward" | ||
) | ||
|
||
self.tableView.tableHeaderView = self.headerView | ||
self.tableView.tableFooterView = UIView(frame: .zero) | ||
} | ||
|
||
override func viewDidLayoutSubviews() { | ||
super.viewDidLayoutSubviews() | ||
|
||
self.tableView.ksr_sizeHeaderFooterViewsToFit() | ||
} | ||
|
||
// MARK: - Configuration | ||
|
||
private func configureHeaderView() { | ||
_ = (self.headerRootStackView, self.headerView) | ||
|> ksr_addSubviewToParent() | ||
|> ksr_constrainViewToEdgesInParent(priority: UILayoutPriority(rawValue: 999)) | ||
|
||
_ = ([self.headerLabel], self.headerRootStackView) | ||
|> ksr_addArrangedSubviewsToStackView() | ||
} | ||
|
||
// MARK: - Styles | ||
|
||
override func bindStyles() { | ||
super.bindStyles() | ||
|
||
_ = self.view | ||
|> checkoutBackgroundStyle | ||
|
||
_ = self.headerLabel | ||
|> checkoutBackgroundStyle | ||
|
||
_ = self.headerLabel | ||
|> \.numberOfLines .~ 0 | ||
|> \.font .~ UIFont.ksr_title1().bolded | ||
|> \.text .~ localizedString( | ||
key: "Customize_your_reward_with_optional_addons", | ||
defaultValue: "Customize your reward with optional add-ons." | ||
) | ||
|
||
_ = self.headerRootStackView | ||
|> \.isLayoutMarginsRelativeArrangement .~ true | ||
|> \.layoutMargins .~ .init(topBottom: Styles.grid(3), leftRight: Styles.grid(4)) | ||
|> \.axis .~ .vertical | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.