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

fix(Bottom Sheet): Fix component to expand horizontally #290

Merged
merged 2 commits into from
Jul 19, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import UIKit

// MARK: InformativeRow

private enum Constants: CGFloat {
case extraLeftMargin = 8
}

class InformativeRow: UIView {
struct Asset {
let url: String
Expand Down Expand Up @@ -53,7 +57,7 @@ class InformativeRow: UIView {

private let bottomContent: UIStackView = {
let stackView = UIStackView()
stackView.spacing = 8
stackView.isLayoutMarginsRelativeArrangement = true
return stackView
}()

Expand All @@ -65,8 +69,6 @@ class InformativeRow: UIView {
label.minHeight = 20
return label
}()

private lazy var dummyView = SpacerView(axis: .horizontal, amount: 1)
}

// MARK: Private
Expand All @@ -84,13 +86,12 @@ private extension InformativeRow {
bottomContent.isHidden = true
}

dummyView.amount = item.icon.size.width
bottomContent.layoutMargins.left = item.icon.size.width + Constants.extraLeftMargin.rawValue
}

func layoutViews() {
addSubview(withDefaultConstraints: centerSection)

bottomContent.addArrangedSubview(dummyView)
bottomContent.addArrangedSubview(detailLabel)

centerSection.addArrangedSubview(topContent)
Expand All @@ -109,7 +110,7 @@ private class TopContentView: UIView {
private var frontStackView: UIStackView = {
let stackView = UIStackView()
stackView.alignment = .center
stackView.spacing = 8
stackView.isLayoutMarginsRelativeArrangement = true
return stackView
}()

Expand Down Expand Up @@ -137,8 +138,6 @@ private class TopContentView: UIView {
return label
}()

private lazy var dummyView = SpacerView(axis: .horizontal, amount: 1)

var title: String? {
didSet {
dummyTitleLabel.text = title
Expand All @@ -150,7 +149,7 @@ private class TopContentView: UIView {
didSet {
iconImageView.intrinsicHeight = icon.size.height
iconImageView.intrinsicWidth = icon.size.width
dummyView.amount = icon.size.width
frontStackView.layoutMargins.left = icon.size.width + Constants.extraLeftMargin.rawValue

load(icon: icon, in: iconImageView)

Expand Down Expand Up @@ -179,7 +178,6 @@ private class TopContentView: UIView {
backStackView.addArrangedSubview(iconImageView)
backStackView.addArrangedSubview(dummyTitleLabel)

frontStackView.addArrangedSubview(dummyView)
frontStackView.addArrangedSubview(titleLabel)
}

Expand Down