vds_ios/VDS/Components/Tilelet/TileletTitleModel.swift
Matt Bruce 98968bacbd refactored out top/bottom spacing config and created new one
updated models to use a StandardStyle
updated Tilelet/TitleLockup to use new features

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2023-06-29 12:06:28 -05:00

51 lines
1.8 KiB
Swift

//
// TiletTitleModel.swift
// VDS
//
// Created by Matt Bruce on 1/6/23.
//
import Foundation
extension Tilelet {
public struct TitleModel {
//--------------------------------------------------
// MARK: - Enums
//--------------------------------------------------
public enum StandardStyle: String, EnumSubset {
case titleXLarge
case titleLarge
case titleMedium
case titleSmall
public var defaultValue: TitleLockup.TitleStandardStyle { .titleSmall }
}
//--------------------------------------------------
// MARK: - Public Properties
//--------------------------------------------------
public var text: String = ""
public var textAttributes: [any LabelAttributeModel]?
public var standardStyle: StandardStyle = .titleSmall
//--------------------------------------------------
// MARK: - Initializers
//--------------------------------------------------
public init(text: String,
textAttributes: [any LabelAttributeModel]? = nil,
standardStyle: StandardStyle = .titleSmall) {
self.text = text
self.textAttributes = textAttributes
self.standardStyle = standardStyle
}
//--------------------------------------------------
// MARK: - Public Functions
//--------------------------------------------------
public func toTitleLockupTitleModel() -> TitleLockup.TitleModel {
TitleLockup.TitleModel(text: text,
textAttributes: textAttributes,
standardStyle: standardStyle.value)
}
}
}