updated to use badgeModel
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
c737ca1344
commit
3b2dc2d447
@ -51,7 +51,7 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{
|
|||||||
eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData)
|
eyebrowModel = viewModel.eyebrowModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
titleModel = viewModel.titleModel(delegateObject: delegateObject, additionalData: additionalData)
|
titleModel = viewModel.titleModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
subTitleModel = viewModel.subTitleModel(delegateObject: delegateObject, additionalData: additionalData)
|
subTitleModel = viewModel.subTitleModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
badgeModel = viewModel.badge
|
badgeModel = viewModel.badgeModel()
|
||||||
descriptiveIconModel = viewModel.descriptiveIcon
|
descriptiveIconModel = viewModel.descriptiveIcon
|
||||||
directionalIconModel = viewModel.directionalIcon
|
directionalIconModel = viewModel.directionalIcon
|
||||||
//setup action
|
//setup action
|
||||||
|
|||||||
@ -18,7 +18,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
|||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
public var badge: Tilelet.BadgeModel?
|
public var badge: BadgeModel?
|
||||||
public var eyebrow: LabelModel?
|
public var eyebrow: LabelModel?
|
||||||
public var eyebrowColor: TitleLockup.TextColor = .primary
|
public var eyebrowColor: TitleLockup.TextColor = .primary
|
||||||
public var title: LabelModel?
|
public var title: LabelModel?
|
||||||
@ -49,7 +49,7 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
|||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
id = try container.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||||
badge = try container.decodeIfPresent(Tilelet.BadgeModel.self, forKey: .badge)
|
badge = try container.decodeIfPresent(BadgeModel.self, forKey: .badge)
|
||||||
eyebrow = try container.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
eyebrow = try container.decodeIfPresent(LabelModel.self, forKey: .eyebrow)
|
||||||
title = try container.decodeIfPresent(LabelModel.self, forKey: .title)
|
title = try container.decodeIfPresent(LabelModel.self, forKey: .title)
|
||||||
subTitle = try container.decodeIfPresent(LabelModel.self, forKey: .subTitle)
|
subTitle = try container.decodeIfPresent(LabelModel.self, forKey: .subTitle)
|
||||||
@ -91,6 +91,17 @@ open class TileletModel: TileContainerBaseModel<Tilelet.Padding, Tilelet>, Molec
|
|||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func badgeModel() -> Tilelet.BadgeModel? {
|
||||||
|
guard let badge else { return nil }
|
||||||
|
return .init(text: badge.text,
|
||||||
|
textColor: badge.textColor,
|
||||||
|
fillColor: badge.fillColor,
|
||||||
|
surface: badge.surface,
|
||||||
|
numberOfLines: badge.numberOfLines,
|
||||||
|
maxWidth: badge.maxWidth
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
public func eyebrowModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.EyebrowModel? {
|
public func eyebrowModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.EyebrowModel? {
|
||||||
guard let eyebrow else { return nil }
|
guard let eyebrow else { return nil }
|
||||||
let attrs = eyebrow.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
|
let attrs = eyebrow.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user