83 lines
2.7 KiB
Swift
83 lines
2.7 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: String, CaseIterable {
|
|
case rightArrow
|
|
case externalLink
|
|
|
|
public var iconName: Icon.Name {
|
|
return self == .rightArrow ? .rightArrow : .externalLink
|
|
}
|
|
}
|
|
|
|
public enum IconSize: String, EnumSubset {
|
|
case small
|
|
case medium
|
|
case large
|
|
|
|
public var defaultValue: Icon.Size { .medium }
|
|
}
|
|
|
|
/// 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: IconSize
|
|
|
|
public init(iconType: IconType = .rightArrow,
|
|
colorConfiguration: SurfaceColorConfiguration = .init(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark),
|
|
size: IconSize = .medium,
|
|
accessibleText: String? = nil) {
|
|
|
|
self.iconType = iconType
|
|
self.colorConfiguration = colorConfiguration
|
|
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
|
|
self.size = size
|
|
}
|
|
}
|
|
}
|