Skip to content

Commit f9f2a20

Browse files
author
Giorgio Ruscigno
committed
Update MigrationStepView, fix margins
1 parent 63edd57 commit f9f2a20

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Views/MigrationStepView.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ class MigrationStepView: UIView {
66
private let centerView: UIView
77
private let actionsView: MigrationActionsView
88

9+
private lazy var centerContentView: UIView = {
10+
let view = UIView()
11+
view.addSubview(centerView)
12+
return view
13+
}()
14+
915
private lazy var mainStackView: UIStackView = {
10-
let stackView = UIStackView(arrangedSubviews: [headerView, centerView])
16+
let stackView = UIStackView(arrangedSubviews: [headerView, centerContentView])
1117
stackView.axis = .vertical
1218
stackView.spacing = Constants.stackViewSpacing
1319
stackView.translatesAutoresizingMaskIntoConstraints = false
@@ -34,7 +40,9 @@ class MigrationStepView: UIView {
3440

3541
self.headerView = headerView
3642
self.centerView = centerView
43+
centerView.translatesAutoresizingMaskIntoConstraints = false
3744
self.actionsView = actionsView
45+
headerView.directionalLayoutMargins = Constants.headerViewMargins
3846
actionsView.translatesAutoresizingMaskIntoConstraints = false
3947
super.init(frame: .zero)
4048
backgroundColor = .systemBackground
@@ -44,7 +52,8 @@ class MigrationStepView: UIView {
4452
}
4553

4654
private func activateConstraints() {
47-
contentView.pinSubviewToAllEdges(mainStackView, insets: Constants.contentMargins)
55+
centerContentView.pinSubviewToAllEdges(centerView, insets: Constants.centerContentMargins)
56+
contentView.pinSubviewToAllEdges(mainStackView)
4857
pinSubviewToAllEdges(mainScrollView)
4958
mainScrollView.pinSubviewToAllEdges(contentView)
5059

@@ -66,8 +75,9 @@ class MigrationStepView: UIView {
6675
}
6776

6877
private enum Constants {
69-
static let contentMargins = UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 30)
78+
static let centerContentMargins = UIEdgeInsets(top: 0, left: 30, bottom: 0, right: 30)
7079
static let stackViewSpacing: CGFloat = 20
7180
static let bottomMargin: CGFloat = 20
81+
static let headerViewMargins = NSDirectionalEdgeInsets(top: 0, leading: 30, bottom: 0, trailing: 30)
7282
}
7383
}

0 commit comments

Comments
 (0)