Skip to content

Commit

Permalink
Style navigation bar for layout picker
Browse files Browse the repository at this point in the history
  • Loading branch information
chipsnyder committed Jul 16, 2020
1 parent b689642 commit b52dcdf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
18 changes: 16 additions & 2 deletions WordPress/Classes/Services/PageCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,24 @@ class PageCoordinator {
let storyboard = UIStoryboard(name: "LayoutPickerStoryboard", bundle: Bundle.main)
guard let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController,
let rootView = navigationController.topViewController as? GutenbergLayoutPickerViewController else {
completion(nil)
return
completion(nil)
return
}
rootView.completion = completion

let font = WPStyleGuide.serifFontForTextStyle(UIFont.TextStyle.largeTitle, fontWeight: .semibold)
let tintColor = UIColor(light: .black, dark: .white)

navigationController.navigationBar.largeTitleTextAttributes = [
NSAttributedString.Key.font: font.withSize(34),
NSAttributedString.Key.foregroundColor: tintColor
]

navigationController.navigationBar.titleTextAttributes = [
NSAttributedString.Key.font: font.withSize(17),
NSAttributedString.Key.foregroundColor: tintColor
]

navigationController.modalPresentationStyle = .pageSheet
controller.present(navigationController, animated: true, completion: nil)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GutenbergLayoutPickerViewController: UIViewController {
let maxTitleFontSize: CGFloat = 34
var maxHeaderHeight: CGFloat = 161
var minHeaderHeight: CGFloat {
return 4 + categoryBar.frame.height + 9
return 9 + categoryBar.frame.height + 9
}

override func viewDidLoad() {
Expand All @@ -33,6 +33,11 @@ class GutenbergLayoutPickerViewController: UIViewController {
closeButton.setImage(UIImage.gridicon(.crossSmall), for: .normal)
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.shadowImage = UIImage()
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
if #available(iOS 13.0, *) {
Expand All @@ -50,6 +55,11 @@ class GutenbergLayoutPickerViewController: UIViewController {
createPage(nil)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
navigationController?.navigationBar.shadowImage = UIImage(color: WPStyleGuide.webViewModalNavigationBarShadow())
super.prepare(for: segue, sender: sender)
}

private func createPage(_ template: String?) {
guard let completion = completion else {
dismiss(animated: true, completion: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<constraint firstAttribute="bottom" secondItem="4ff-7z-VN8" secondAttribute="bottom" id="GwS-lS-4cI"/>
<constraint firstItem="yqC-YH-PXy" firstAttribute="centerX" secondItem="DTZ-MR-Eqm" secondAttribute="centerX" id="NW7-GP-Ix1"/>
<constraint firstItem="fhN-6z-taa" firstAttribute="top" secondItem="yqC-YH-PXy" secondAttribute="bottom" constant="20" id="TWT-Wj-G1p"/>
<constraint firstItem="fhN-6z-taa" firstAttribute="top" relation="greaterThanOrEqual" secondItem="DTZ-MR-Eqm" secondAttribute="top" constant="4" id="dVp-aN-dR9"/>
<constraint firstItem="fhN-6z-taa" firstAttribute="top" relation="greaterThanOrEqual" secondItem="DTZ-MR-Eqm" secondAttribute="top" constant="9" id="dVp-aN-dR9"/>
<constraint firstAttribute="trailing" secondItem="4ff-7z-VN8" secondAttribute="trailing" id="lHV-hQ-Tyq"/>
<constraint firstItem="fhN-6z-taa" firstAttribute="leading" secondItem="DTZ-MR-Eqm" secondAttribute="leading" id="q90-Gh-IhP"/>
<constraint firstAttribute="bottom" secondItem="fhN-6z-taa" secondAttribute="bottom" priority="750" constant="24" id="vJ5-2N-JfP"/>
Expand Down

0 comments on commit b52dcdf

Please sign in to comment.