vds_ios/VDS/Components/Tilelet/TileletIconModels.swift

75 lines
2.4 KiB
Swift

//
// TiletDescriptiveIconModel.swift
// VDS
//
// Created by Matt Bruce on 1/11/23.
//
import Foundation
import UIKit
import VDSCoreTokens
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 color: UIColor
/// Enum for a preset height and width for the icon.
public var size: Icon.Size
/// Accessible Text for the Icon
public var accessibleText: String
/// Current Surface and this is used to pass down to child objects that implement Surfacable
public var surface: Surface
public init(name: Icon.Name = .multipleDocuments, color: UIColor = VDSColor.paletteBlack, size: Icon.Size = .medium, accessibleText: String? = nil, surface: Surface = .dark) {
self.name = name
self.color = color
self.accessibleText = accessibleText ?? name.rawValue
self.size = size
self.surface = surface
}
}
/// 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 color: UIColor
/// 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
/// Current Surface and this is used to pass down to child objects that implement Surfacable
public var surface: Surface
public init(iconType: IconType = .rightArrow, color: UIColor = VDSColor.paletteBlack, size: Icon.Size = .medium, accessibleText: String? = nil, surface: Surface = .dark) {
self.iconType = iconType
self.color = color
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
self.size = size
self.surface = surface
}
}
}