refactored structs into parent
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
9526a7ec40
commit
cdaa86a59e
@ -171,13 +171,13 @@ open class Tilet: TileContainer {
|
||||
open var textPostion: TextPosition = .top { didSet { didChange() }}
|
||||
|
||||
//models
|
||||
public var badgeModel: TiletBadgeModel? { didSet { didChange() }}
|
||||
public var titleModel: TiletTitleModel? { didSet { didChange() }}
|
||||
public var subTitleModel: TiletSubTitleModel? { didSet { didChange() }}
|
||||
public var badgeModel: BadgeModel? { didSet { didChange() }}
|
||||
public var titleModel: TitleModel? { didSet { didChange() }}
|
||||
public var subTitleModel: SubTitleModel? { didSet { didChange() }}
|
||||
|
||||
//only 1 Icon can be active
|
||||
private var _descriptiveIconModel: TiletDescriptiveIcon?
|
||||
public var descriptiveIconModel: TiletDescriptiveIcon? {
|
||||
private var _descriptiveIconModel: DescriptiveIcon?
|
||||
public var descriptiveIconModel: DescriptiveIcon? {
|
||||
get { _descriptiveIconModel }
|
||||
set {
|
||||
_descriptiveIconModel = newValue;
|
||||
@ -186,8 +186,8 @@ open class Tilet: TileContainer {
|
||||
}
|
||||
}
|
||||
|
||||
private var _directionalIconModel: TiletDirectionalIcon?
|
||||
public var directionalIconModel: TiletDirectionalIcon? {
|
||||
private var _directionalIconModel: DirectionalIcon?
|
||||
public var directionalIconModel: DirectionalIcon? {
|
||||
get { _directionalIconModel }
|
||||
set {
|
||||
_directionalIconModel = newValue;
|
||||
|
||||
@ -7,17 +7,19 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TiletBadgeModel: Codable {
|
||||
public var text: String = ""
|
||||
public var fillColor:Badge.FillColor
|
||||
public var surface: Surface
|
||||
public var numberOfLines: Int
|
||||
public var maxWidth: CGFloat?
|
||||
public init(text: String, fillColor: Badge.FillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) {
|
||||
self.text = text
|
||||
self.fillColor = fillColor
|
||||
self.surface = surface
|
||||
self.numberOfLines = numberOfLines
|
||||
self.maxWidth = maxWidth
|
||||
extension Tilet {
|
||||
public struct BadgeModel: Codable {
|
||||
public var text: String = ""
|
||||
public var fillColor:Badge.FillColor
|
||||
public var surface: Surface
|
||||
public var numberOfLines: Int
|
||||
public var maxWidth: CGFloat?
|
||||
public init(text: String, fillColor: Badge.FillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) {
|
||||
self.text = text
|
||||
self.fillColor = fillColor
|
||||
self.surface = surface
|
||||
self.numberOfLines = numberOfLines
|
||||
self.maxWidth = maxWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,24 +8,27 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
public struct TiletDescriptiveIcon: Codable {
|
||||
public var name: Icon.Name = .multipleDocuments
|
||||
public var size: Icon.Size = .medium
|
||||
public var surface: Surface = .dark
|
||||
extension Tilet {
|
||||
|
||||
public init(name: Icon.Name = .multipleDocuments, size: Icon.Size, surface: Surface) {
|
||||
self.name = name
|
||||
self.size = size
|
||||
self.surface = surface
|
||||
}
|
||||
}
|
||||
|
||||
public struct TiletDirectionalIcon: Codable {
|
||||
public var size: Icon.Size = .medium
|
||||
public var surface: Surface = .dark
|
||||
|
||||
public init(size: Icon.Size, surface: Surface) {
|
||||
self.size = size
|
||||
self.surface = surface
|
||||
public struct DescriptiveIcon: Codable {
|
||||
public var name: Icon.Name = .multipleDocuments
|
||||
public var size: Icon.Size = .medium
|
||||
public var surface: Surface = .dark
|
||||
|
||||
public init(name: Icon.Name = .multipleDocuments, size: Icon.Size, surface: Surface) {
|
||||
self.name = name
|
||||
self.size = size
|
||||
self.surface = surface
|
||||
}
|
||||
}
|
||||
|
||||
public struct DirectionalIcon: Codable {
|
||||
public var size: Icon.Size = .medium
|
||||
public var surface: Surface = .dark
|
||||
|
||||
public init(size: Icon.Size, surface: Surface) {
|
||||
self.size = size
|
||||
self.surface = surface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,46 +7,48 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TiletSubTitleModel: Codable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
public enum TextStyle: String, Codable, EnumSubset {
|
||||
case BodyLarge
|
||||
case BoldBodyLarge
|
||||
case BodyMedium
|
||||
case BoldBodyMedium
|
||||
case BodySmall
|
||||
case BoldBodySmall
|
||||
extension Tilet {
|
||||
public struct SubTitleModel: Codable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
public enum TextStyle: String, Codable, EnumSubset {
|
||||
case BodyLarge
|
||||
case BoldBodyLarge
|
||||
case BodyMedium
|
||||
case BoldBodyMedium
|
||||
case BodySmall
|
||||
case BoldBodySmall
|
||||
|
||||
public var defaultValue: TitleLockup.OtherTextStyle { .BodySmall }
|
||||
}
|
||||
|
||||
public var defaultValue: TitleLockup.OtherTextStyle { .BodySmall }
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
public var text: String = ""
|
||||
public var textStyle: TextStyle = .BodySmall
|
||||
public var textColor: Use = .primary
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
public init(text: String,
|
||||
textColor: Use = .primary,
|
||||
textAttributes: [any LabelAttributeModel]? = nil,
|
||||
textStyle: TextStyle = .BodySmall) {
|
||||
self.text = text
|
||||
self.textColor = textColor
|
||||
self.textStyle = textStyle
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Functions
|
||||
//--------------------------------------------------
|
||||
public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel {
|
||||
TitleLockup.SubTitleModel(text: text,
|
||||
textColor: textColor,
|
||||
textAttributes: nil)
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
public var text: String = ""
|
||||
public var textStyle: TextStyle = .BodySmall
|
||||
public var textColor: Use = .primary
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
public init(text: String,
|
||||
textColor: Use = .primary,
|
||||
textAttributes: [any LabelAttributeModel]? = nil,
|
||||
textStyle: TextStyle = .BodySmall) {
|
||||
self.text = text
|
||||
self.textColor = textColor
|
||||
self.textStyle = textStyle
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Functions
|
||||
//--------------------------------------------------
|
||||
public func toTitleLockupSubTitleModel() -> TitleLockup.SubTitleModel {
|
||||
TitleLockup.SubTitleModel(text: text,
|
||||
textColor: textColor,
|
||||
textAttributes: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,44 +7,46 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct TiletTitleModel: Codable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
public enum TextStyle: String, EnumSubset, Codable {
|
||||
case TitleXLarge
|
||||
case BoldTitleXLarge
|
||||
case TitleLarge
|
||||
case BoldTitleLarge
|
||||
case TitleMedium
|
||||
case BoldTitleMedium
|
||||
case TitleSmall
|
||||
case BoldTitleSmall
|
||||
extension Tilet {
|
||||
public struct TitleModel: Codable {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
public enum TextStyle: String, EnumSubset, Codable {
|
||||
case TitleXLarge
|
||||
case BoldTitleXLarge
|
||||
case TitleLarge
|
||||
case BoldTitleLarge
|
||||
case TitleMedium
|
||||
case BoldTitleMedium
|
||||
case TitleSmall
|
||||
case BoldTitleSmall
|
||||
|
||||
public var defaultValue: TitleLockup.TitleTextStyle { .BoldTitleSmall }
|
||||
}
|
||||
|
||||
public var defaultValue: TitleLockup.TitleTextStyle { .BoldTitleSmall }
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
public var text: String = ""
|
||||
public var textStyle: TextStyle = .BoldTitleSmall
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
public init(text: String,
|
||||
textStyle: TextStyle = .BoldTitleSmall) {
|
||||
self.text = text
|
||||
self.textStyle = textStyle
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Functions
|
||||
//--------------------------------------------------
|
||||
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
|
||||
TitleLockup.TitleModel(text: text,
|
||||
textAttributes: nil,
|
||||
textStyle: textStyle.value)
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
public var text: String = ""
|
||||
public var textStyle: TextStyle = .BoldTitleSmall
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
//--------------------------------------------------
|
||||
public init(text: String,
|
||||
textStyle: TextStyle = .BoldTitleSmall) {
|
||||
self.text = text
|
||||
self.textStyle = textStyle
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Functions
|
||||
//--------------------------------------------------
|
||||
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
|
||||
TitleLockup.TitleModel(text: text,
|
||||
textAttributes: nil,
|
||||
textStyle: textStyle.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user