initial cut
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
38310b5ab1
commit
fdd6360f31
@ -540,7 +540,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
var showIconContainerView = false
|
||||
if let descriptiveIconModel {
|
||||
descriptiveIcon.name = descriptiveIconModel.name
|
||||
descriptiveIcon.colorConfiguration = descriptiveIconModel.colorConfiguration
|
||||
descriptiveIcon.color = descriptiveIconModel.iconColor.uiColor ?? VDSColor.paletteBlack
|
||||
descriptiveIcon.size = descriptiveIconModel.size
|
||||
descriptiveIcon.surface = backgroundColorSurface
|
||||
showIconContainerView = true
|
||||
@ -548,7 +548,7 @@ open class Tilelet: TileContainerBase<Tilelet.Padding> {
|
||||
|
||||
if let directionalIconModel {
|
||||
directionalIcon.name = directionalIconModel.iconType.iconName
|
||||
directionalIcon.colorConfiguration = directionalIconModel.colorConfiguration
|
||||
directionalIcon.color = directionalIconModel.iconColor.uiColor ?? VDSColor.paletteBlack
|
||||
directionalIcon.size = directionalIconModel.size.value
|
||||
directionalIcon.surface = backgroundColorSurface
|
||||
showIconContainerView = true
|
||||
|
||||
@ -11,13 +11,33 @@ import VDSTokens
|
||||
|
||||
extension Tilelet {
|
||||
|
||||
public enum IconColor: Equatable {
|
||||
case token(UIColor.VDSColor)
|
||||
case custom(UIColor)
|
||||
|
||||
private var reflectedValue: String { String(reflecting: self) }
|
||||
|
||||
public static func == (lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.reflectedValue == rhs.reflectedValue
|
||||
}
|
||||
|
||||
public var uiColor: UIColor {
|
||||
switch self {
|
||||
case .token(let color):
|
||||
return color
|
||||
case .custom(let color):
|
||||
return color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
public var iconColor: IconColor?
|
||||
|
||||
/// Enum for a preset height and width for the icon.
|
||||
public var size: Icon.Size
|
||||
@ -26,12 +46,12 @@ extension Tilelet {
|
||||
public var accessibleText: String
|
||||
|
||||
public init(name: Icon.Name = .multipleDocuments,
|
||||
colorConfiguration: SurfaceColorConfiguration = .init(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark),
|
||||
iconColor: IconColor? = nil,
|
||||
size: Icon.Size = .medium,
|
||||
accessibleText: String? = nil) {
|
||||
|
||||
self.name = name
|
||||
self.colorConfiguration = colorConfiguration
|
||||
self.iconColor = iconColor
|
||||
self.accessibleText = accessibleText ?? name.rawValue
|
||||
self.size = size
|
||||
}
|
||||
@ -57,7 +77,7 @@ extension Tilelet {
|
||||
}
|
||||
|
||||
/// Color of the icon.
|
||||
public var colorConfiguration: SurfaceColorConfiguration
|
||||
public var iconColor: IconColor?
|
||||
|
||||
/// Accessible Text for the Icon
|
||||
public var accessibleText: String
|
||||
@ -69,12 +89,12 @@ extension Tilelet {
|
||||
public var size: IconSize
|
||||
|
||||
public init(iconType: IconType = .rightArrow,
|
||||
colorConfiguration: SurfaceColorConfiguration = .init(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark),
|
||||
iconColor: IconColor? = nil,
|
||||
size: IconSize = .medium,
|
||||
accessibleText: String? = nil) {
|
||||
|
||||
self.iconType = iconType
|
||||
self.colorConfiguration = colorConfiguration
|
||||
self.iconColor = iconColor
|
||||
self.accessibleText = accessibleText ?? iconType.iconName.rawValue
|
||||
self.size = size
|
||||
}
|
||||
|
||||
@ -17,7 +17,8 @@ extension TitleLockup {
|
||||
public enum TextColor: Equatable {
|
||||
case primary
|
||||
case secondary
|
||||
case custom(UIColor, UIColor)
|
||||
case token(UIColor.VDSColor)
|
||||
case custom(UIColor)
|
||||
|
||||
private var reflectedValue: String { String(reflecting: self) }
|
||||
|
||||
@ -31,15 +32,18 @@ extension TitleLockup {
|
||||
TitleLockup.textColorPrimaryConfiguration
|
||||
case .secondary:
|
||||
TitleLockup.textColorSecondaryConfiguration
|
||||
case .custom(let lightColor, let darkColor):
|
||||
SurfaceColorConfiguration(lightColor, darkColor).eraseToAnyColorable()
|
||||
case .token(let color):
|
||||
SurfaceColorConfiguration(color.uiColor, color.uiColor).eraseToAnyColorable()
|
||||
case .custom(let color):
|
||||
SurfaceColorConfiguration(color, color).eraseToAnyColorable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum TitleTextColor: Equatable {
|
||||
case primary
|
||||
case custom(UIColor, UIColor)
|
||||
case token(UIColor.VDSColor)
|
||||
case custom(UIColor)
|
||||
|
||||
private var reflectedValue: String { String(reflecting: self) }
|
||||
|
||||
@ -51,8 +55,10 @@ extension TitleLockup {
|
||||
switch self {
|
||||
case .primary:
|
||||
TitleLockup.textColorPrimaryConfiguration
|
||||
case .custom(let lightColor, let darkColor):
|
||||
SurfaceColorConfiguration(lightColor, darkColor).eraseToAnyColorable()
|
||||
case .token(let color):
|
||||
SurfaceColorConfiguration(color.uiColor, color.uiColor).eraseToAnyColorable()
|
||||
case .custom(let color):
|
||||
SurfaceColorConfiguration(color, color).eraseToAnyColorable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user