Code changes as per review comment.
This commit is contained in:
parent
0256ede110
commit
25ce6b285f
@ -14,30 +14,22 @@ import Foundation
|
|||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
public var title = Label(fontStyle: .RegularMicro)
|
public var title = Label(fontStyle: .RegularMicro)
|
||||||
public var topLeftHeadlineBody = HeadlineBody()
|
public var topLeftHeadlineBody = HeadlineBody()
|
||||||
public var bottomLeftHeadlineBody = HeadlineBody()
|
|
||||||
public var verticalStack1: Stack<StackModel>
|
|
||||||
public var topCenterHeadlineBody = HeadlineBody()
|
public var topCenterHeadlineBody = HeadlineBody()
|
||||||
public var bottomCenterHeadlineBody = HeadlineBody()
|
|
||||||
public var verticalStack2: Stack<StackModel>
|
|
||||||
public var topRightHeadlineBody = HeadlineBody()
|
public var topRightHeadlineBody = HeadlineBody()
|
||||||
|
public var tophorizontalStack: Stack<StackModel>
|
||||||
|
public var bottomLeftHeadlineBody = HeadlineBody()
|
||||||
|
public var bottomCenterHeadlineBody = HeadlineBody()
|
||||||
public var bottomRightHeadlineBody = HeadlineBody()
|
public var bottomRightHeadlineBody = HeadlineBody()
|
||||||
public var verticalStack3: Stack<StackModel>
|
public var bottomhorizontalStack: Stack<StackModel>
|
||||||
public var horizontalStack: Stack<StackModel>
|
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
tophorizontalStack = Stack<StackModel>.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: topCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: topRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal)
|
||||||
verticalStack1 = Stack<StackModel>.createStack(with: [(view: topLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomLeftHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
bottomhorizontalStack = Stack<StackModel>.createStack(with: [(view: bottomLeftHeadlineBody, model: StackItemModel(percent: 37, verticalAlignment: .top)), (view: bottomCenterHeadlineBody, model: StackItemModel(percent: 33, verticalAlignment: .top)), (view: bottomRightHeadlineBody, model: StackItemModel(percent: 30, verticalAlignment: .top))], axis: .horizontal)
|
||||||
verticalStack2 = Stack<StackModel>.createStack(with: [(view: topCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomCenterHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
stack = Stack<StackModel>.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: tophorizontalStack, model: StackItemModel(spacing: 2, horizontalAlignment: .leading)), (view: bottomhorizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
||||||
verticalStack3 = Stack<StackModel>.createStack(with: [(view: topRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading)), (view: bottomRightHeadlineBody, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical)
|
|
||||||
horizontalStack = Stack<StackModel>.createStack(with: [(view: verticalStack1, model: StackItemModel(percent: 37, horizontalAlignment: .leading)),
|
|
||||||
(view: verticalStack2, model: StackItemModel(percent: 33, horizontalAlignment: .leading)),
|
|
||||||
(view: verticalStack3, model: StackItemModel(percent: 30, horizontalAlignment: .leading))],
|
|
||||||
axis: .horizontal)
|
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: title, model: StackItemModel(horizontalAlignment: .leading)), (view: horizontalStack, model: StackItemModel(horizontalAlignment: .leading))], axis: .vertical, spacing: 2)
|
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,10 +45,8 @@ import Foundation
|
|||||||
title.numberOfLines = 1
|
title.numberOfLines = 1
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
verticalStack1.restack()
|
tophorizontalStack.restack()
|
||||||
verticalStack2.restack()
|
bottomhorizontalStack.restack()
|
||||||
verticalStack3.restack()
|
|
||||||
horizontalStack.restack()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -66,9 +56,8 @@ import Foundation
|
|||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ListThreeColumnSpeedTestModel else { return }
|
guard let model = model as? ListThreeColumnSpeedTestModel else { return }
|
||||||
title.set(with: model.title, delegateObject, additionalData)
|
title.set(with: model.title, delegateObject, additionalData)
|
||||||
verticalStack1.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.bottomLeftHeadlineBody], delegateObject, additionalData)
|
tophorizontalStack.updateContainedMolecules(with: [model.topLeftHeadlineBody, model.topCenterHeadlineBody, model.topRightHeadlineBody], delegateObject, additionalData)
|
||||||
verticalStack2.updateContainedMolecules(with: [model.topCenterHeadlineBody, model.bottomCenterHeadlineBody], delegateObject, additionalData)
|
bottomhorizontalStack.updateContainedMolecules(with: [model.bottomLeftHeadlineBody, model.bottomCenterHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData)
|
||||||
verticalStack3.updateContainedMolecules(with: [model.topRightHeadlineBody, model.bottomRightHeadlineBody], delegateObject, additionalData)
|
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,24 +68,12 @@ import Foundation
|
|||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
title.setFontStyle(.BoldBodySmall)
|
title.setFontStyle(.BoldBodySmall)
|
||||||
styleHeadlineBody(topLeftHeadlineBody, true)
|
topLeftHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||||
styleHeadlineBody(bottomLeftHeadlineBody, false)
|
topCenterHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||||
styleHeadlineBody(topCenterHeadlineBody, false)
|
topRightHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||||
styleHeadlineBody(bottomCenterHeadlineBody, false)
|
bottomLeftHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||||
styleHeadlineBody(topRightHeadlineBody, false)
|
bottomCenterHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||||
styleHeadlineBody(bottomRightHeadlineBody, false)
|
bottomRightHeadlineBody.spaceBetweenLabelsConstant = 2
|
||||||
}
|
|
||||||
|
|
||||||
//Method to style headline label and message label of HeadlineBody
|
|
||||||
func styleHeadlineBody(_ headlineBody: HeadlineBody, _ isBodyMicro: Bool) {
|
|
||||||
headlineBody.headlineLabel.setFontStyle(.RegularMicro)
|
|
||||||
headlineBody.headlineLabel.textColor = .mvmCoolGray6
|
|
||||||
headlineBody.messageLabel.setFontStyle(.RegularBodySmall)
|
|
||||||
if isBodyMicro {
|
|
||||||
headlineBody.messageLabel.setFontStyle(.RegularMicro)
|
|
||||||
headlineBody.messageLabel.textColor = .mvmCoolGray6
|
|
||||||
}
|
|
||||||
headlineBody.spaceBetweenLabelsConstant = 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -35,6 +35,30 @@ public class ListThreeColumnSpeedTestModel: ListItemModel, MoleculeModelProtocol
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
// MARK: - Method
|
||||||
|
//------------------------------------------------------
|
||||||
|
override public func setDefaults() {
|
||||||
|
styleHeadlineBody(topLeftHeadlineBody, true)
|
||||||
|
styleHeadlineBody(bottomLeftHeadlineBody, false)
|
||||||
|
styleHeadlineBody(topCenterHeadlineBody, false)
|
||||||
|
styleHeadlineBody(bottomCenterHeadlineBody, false)
|
||||||
|
styleHeadlineBody(topRightHeadlineBody, false)
|
||||||
|
styleHeadlineBody(bottomRightHeadlineBody, false)
|
||||||
|
super.setDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
|
//Method to style headline and body of HeadlineBody
|
||||||
|
func styleHeadlineBody(_ headlineBodyModel: HeadlineBodyModel, _ isBodyMicro: Bool) {
|
||||||
|
headlineBodyModel.headline?.fontStyle = .RegularMicro
|
||||||
|
headlineBodyModel.headline?.textColor = Color(uiColor: .mvmCoolGray6)
|
||||||
|
headlineBodyModel.body?.fontStyle = .RegularBodySmall
|
||||||
|
if isBodyMicro {
|
||||||
|
headlineBodyModel.body?.fontStyle = .RegularMicro
|
||||||
|
headlineBodyModel.body?.textColor = Color(uiColor: .mvmCoolGray6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user