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