Digital ACT-191 ONEAPP-11355 story: adjusted alignments
This commit is contained in:
parent
62aedc7c5a
commit
4797e5a7f7
@ -151,6 +151,7 @@ open class ListUnordered: View {
|
||||
open override func updateView() {
|
||||
super.updateView()
|
||||
listStackView.removeArrangedSubviews()
|
||||
listStackView.subviews.forEach { $0.removeFromSuperview() }
|
||||
listStackView.spacing = spaceBetweenItems
|
||||
|
||||
if leadInText != nil {
|
||||
@ -167,8 +168,6 @@ open class ListUnordered: View {
|
||||
listStackView.addArrangedSubview(listItem)
|
||||
}
|
||||
}
|
||||
setNeedsLayout()
|
||||
layoutIfNeeded()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -197,7 +196,6 @@ open class ListUnordered: View {
|
||||
$0.spacing = padding
|
||||
$0.backgroundColor = .clear
|
||||
}
|
||||
itemStackView.removeArrangedSubviews()
|
||||
|
||||
// StackView with LeadIntext if provided.
|
||||
if leadInText != nil {
|
||||
@ -207,23 +205,32 @@ open class ListUnordered: View {
|
||||
|
||||
// StackView with Level 1 Text if provided.
|
||||
if levelOneText != nil {
|
||||
|
||||
// Add level 1 glyph: 'disc, bold'
|
||||
let discLabel = getLabel(with: disc, surface: surface)
|
||||
discLabel.widthAnchor.constraint(equalToConstant: discLabel.intrinsicContentSize.width).activate()
|
||||
itemStackView.addArrangedSubview(discLabel)
|
||||
|
||||
// Add level 1 Text
|
||||
let levelOneLabel = getLabel(with: levelOneText, surface: surface)
|
||||
itemStackView.addArrangedSubview(levelOneLabel)
|
||||
}
|
||||
|
||||
// StackView with Level 2 Text if provided.
|
||||
if levelTwoText != nil {
|
||||
let discLabel = getLabel(with: disc, surface: surface)
|
||||
|
||||
// Set level 2 leading space as needed for alignment.
|
||||
let discSpaceView = View()
|
||||
let discLabel = getLabel(with: disc, surface: surface)
|
||||
discSpaceView.widthAnchor.constraint(equalToConstant: discLabel.intrinsicContentSize.width).activate()
|
||||
discSpaceView.backgroundColor = .red
|
||||
itemStackView.addArrangedSubview(discSpaceView)
|
||||
|
||||
// Add level 2 glyph: 'en dash, regular'
|
||||
let endashLabel = getLabel(with: endash, surface: surface)
|
||||
endashLabel.widthAnchor.constraint(equalToConstant: endashLabel.intrinsicContentSize.width).activate()
|
||||
itemStackView.addArrangedSubview(endashLabel)
|
||||
|
||||
// Add level 2 Text
|
||||
let levelTwoLabel = getLabel(with: levelTwoText, surface: surface)
|
||||
itemStackView.addArrangedSubview(levelTwoLabel)
|
||||
}
|
||||
|
||||
@ -13,11 +13,11 @@ extension ListUnordered {
|
||||
public var levelOneText: String
|
||||
|
||||
/// Item Level 2 that shows text (one or many) with glyph - en dash. This is optional.
|
||||
public var levelTwoText: [String]?
|
||||
public var levelTwoText: [String?]?
|
||||
|
||||
public init(itemLevelOneText: String, itemLevelTwoTexts: [String]? = nil) {
|
||||
public init(itemLevelOneText: String, itemLevelTwoTexts: [String?]? = nil) {
|
||||
self.levelOneText = itemLevelOneText
|
||||
self.levelTwoText = itemLevelTwoTexts ?? []
|
||||
self.levelTwoText = itemLevelTwoTexts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user