46 lines
1.3 KiB
Swift
46 lines
1.3 KiB
Swift
//
|
|
// TiletTitleModel.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 1/6/23.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct TiletTitleModel {
|
|
public enum TitleTypographicalStyle: String, EnumSubset {
|
|
case TitleXLarge
|
|
case BoldTitleXLarge
|
|
case TitleLarge
|
|
case BoldTitleLarge
|
|
case TitleMedium
|
|
case BoldTitleMedium
|
|
case TitleSmall
|
|
case BoldTitleSmall
|
|
|
|
public var defaultValue: TitleLockupTitleTypographicalStyle { .BoldTitleSmall }
|
|
}
|
|
|
|
public var text: String = ""
|
|
public var textAttributes: [any LabelAttributeModel]?
|
|
public var typographicalStyle: TitleTypographicalStyle
|
|
|
|
public init(text: String,
|
|
textAttributes: [any LabelAttributeModel]? = nil,
|
|
typographicalStyle: TitleTypographicalStyle = .BoldTitleSmall) {
|
|
self.text = text
|
|
self.textAttributes = textAttributes
|
|
self.typographicalStyle = typographicalStyle
|
|
}
|
|
}
|
|
|
|
extension TitleLockup {
|
|
internal func set(with model: TiletTitleModel?) {
|
|
if let model, !model.text.isEmpty {
|
|
titleModel = TitleLockupTitleModel(text: model.text, textAttributes: model.textAttributes, typographicalStyle: model.typographicalStyle.value)
|
|
} else {
|
|
titleModel = nil
|
|
}
|
|
}
|
|
}
|