vds_ios/VDS/Components/Tilelet/TileletIconModels.swift
Matt Bruce 8c3bce746e refactored models
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2024-05-22 15:33:30 -05:00

75 lines
2.4 KiB
Swift

//
// TiletDescriptiveIconModel.swift
// VDS
//
// Created by Matt Bruce on 1/11/23.
//
import Foundation
import UIKit
import VDSTokens
extension Tilelet {
/// Model that represents the options available for the descriptive icon.
public struct DescriptiveIcon {
/// A representation that will be used to render the icon with corresponding name.
public var name: Icon.Name
/// Color of the icon.
public var colorConfiguration: SurfaceColorConfiguration
/// Enum for a preset height and width for the icon.
public var size: Icon.Size
/// Accessible Text for the Icon
public var accessibleText: String
public init(name: Icon.Name = .multipleDocuments,
colorConfiguration: SurfaceColorConfiguration = .init(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark),
size: Icon.Size = .medium,
accessibleText: String? = nil) {
self.name = name
self.colorConfiguration = colorConfiguration
self.accessibleText = accessibleText ?? name.rawValue
self.size = size
}
}
/// Model that represents the options available for the directional icon.
public struct DirectionalIcon {
public enum IconType {
case rightArrow
case externalLink
public var iconName: Icon.Name {
return self == .rightArrow ? .rightArrow : .externalLink
}
}
/// Color of the icon.
public var colorConfiguration: SurfaceColorConfiguration
/// Accessible Text for the Icon
public var accessibleText: String
/// Enum for a icon type you want shown..
public var iconType: IconType
/// Enum for a preset height and width for the icon.
public var size: Icon.Size
public init(iconType: IconType = .rightArrow,
colorConfiguration: SurfaceColorConfiguration = .init(.black, .white),
size: Icon.Size = .medium,
accessibleText: String? = nil) {
self.iconType = iconType
self.colorConfiguration = colorConfiguration
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
self.size = size
}
}
}