Modifying line component as part of VDS for brand 3.0

This commit is contained in:
Sumanth Nadigadda 2022-04-03 00:47:52 +05:30
parent aa6558a716
commit 18f9449e42
7 changed files with 21 additions and 21 deletions

View File

@ -48,17 +48,17 @@ import UIKit
public init() {
super.init(frame: .zero)
model = LineModel(type: .standard)
model = LineModel(type: .secondary)
}
public override init(frame: CGRect) {
super.init(frame: frame)
model = LineModel(type: .standard)
model = LineModel(type: .secondary)
}
public required init?(coder: NSCoder) {
super.init(coder: coder)
model = LineModel(type: .standard)
model = LineModel(type: .secondary)
}
public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
@ -106,7 +106,7 @@ import UIKit
}
open override func reset() {
setStyle(.standard)
setStyle(.secondary)
}
public override static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {

View File

@ -30,15 +30,15 @@ import VDSColorTokens
/**
The style of the line:
- standard (1 height, silver)
- thin (1 height, black)
- secondary (1 height, silver)
- primary (1 height, black)
- medium (2 height, black)
- heavy (4 height, black)
- none (hidden)
*/
public enum Style: String, Codable {
case standard
case thin
case secondary
case primary
case medium
case heavy
case none
@ -49,7 +49,7 @@ import VDSColorTokens
//--------------------------------------------------
public static var identifier: String = "line"
public var type: Style = .standard
public var type: Style = .secondary
public var frequency: Frequency? = .allExceptTop
//TODO: use color insted of backgroundColor. Needs server changes
@ -59,10 +59,10 @@ import VDSColorTokens
get {
if let backgroundColor = _backgroundColor { return backgroundColor }
if inverted {
if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOndark) }
if type == .secondary { return Color(uiColor: VDSColor.paletteGray20) }
return Color(uiColor: VDSColor.elementsPrimaryOndark)
}
if type == .standard { return Color(uiColor: VDSColor.interactiveDisabledOnlight) }
if type == .secondary { return Color(uiColor: VDSColor.paletteGray85) }
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
}
set {

View File

@ -22,7 +22,7 @@ import Foundation
public override func setupView() {
super.setupView()
line.setStyle(.thin)
line.setStyle(.primary)
contentView.addSubview(line)
NSLayoutConstraint.pinViewBottom(toSuperview: line, useMargins: false, constant: 0).isActive = true
NSLayoutConstraint.pinViewLeft(toSuperview: line, useMargins: true, constant: 0).isActive = true
@ -51,7 +51,7 @@ import Foundation
open override func reset() {
super.reset()
line.setStyle(.thin)
line.setStyle(.primary)
molecule?.reset()
}

View File

@ -42,7 +42,7 @@
bottomPadding = PaddingDefaultVerticalSpacing3
}
if line == nil {
line = LineModel(type: .thin)
line = LineModel(type: .primary)
}
}

View File

@ -24,7 +24,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
open var title: String?
open var hidden = false
open var line: LineModel? = LineModel(type: .standard)
open var line: LineModel? = LineModel(type: .secondary)
open var hidesSystemBackButton = true
open var style: NavigationItemStyle?

View File

@ -42,13 +42,13 @@ import UIKit
switch style {
case .standard?:
topSeparatorView?.setStyle(.none)
bottomSeparatorView?.setStyle(.standard)
bottomSeparatorView?.setStyle(.secondary)
case .shortDivider?:
topSeparatorView?.setStyle(.none)
bottomSeparatorView?.setStyle(.thin)
bottomSeparatorView?.setStyle(.primary)
case .tallDivider?:
topSeparatorView?.setStyle(.none)
bottomSeparatorView?.setStyle(.thin)
bottomSeparatorView?.setStyle(.primary)
case .sectionFooter?:
topSeparatorView?.setStyle(.none)
bottomSeparatorView?.setStyle(.none)
@ -244,8 +244,8 @@ import UIKit
topSeparatorView?.set(with: model, delegateObject, additionalData)
bottomSeparatorView?.set(with: model, delegateObject, additionalData)
} else {
topSeparatorView?.setStyle(.standard)
bottomSeparatorView?.setStyle(.standard)
topSeparatorView?.setStyle(.secondary)
bottomSeparatorView?.setStyle(.secondary)
}
setSeparatorFrequency(model?.frequency ?? .allExceptTop, indexPath: indexPath)
}

View File

@ -34,7 +34,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
}()
public lazy var line: Line = {
return Line(model: LineModel(type: .standard), delegateObjectIVar, nil)
return Line(model: LineModel(type: .secondary), delegateObjectIVar, nil)
}()
public lazy var subNavigationController: UINavigationController = {