got titlelockup example working

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-05 10:56:37 -05:00
parent c344d0196b
commit 2253f0fadb

View File

@ -71,7 +71,7 @@ class TileletViewController: BaseViewController<Tilelet> {
enum ColorPickerType {
case backgroundColor
case gradientColor1, gradientColor2
case contentViewBackgroundColor, custom
case contentViewBackgroundColor, token, custom
}
lazy var gradientColorView1: ColorPickerView<ColorPickerType> = {
@ -114,6 +114,10 @@ class TileletViewController: BaseViewController<Tilelet> {
case primary, secondary, token, custom
}
enum IconColor: String, CaseIterable {
case token, custom
}
/// eyebrow
var eyebrowColorsFormStackView = FormSection().with { $0.isHidden = true }
lazy var eyebrowColorPickerSelectorView = {
@ -605,14 +609,8 @@ class TileletViewController: BaseViewController<Tilelet> {
let token = descriptionIconTokenColorView.selectedItem
let iconSize = descriptionIconSizePickerSelectorView.selectedItem
let iconName = descriptionNamePickerSelectorView.selectedItem
if let iconColor {
component.descriptiveIconModel = .init(name: iconName,
iconColor: iconColor, size: iconSize)
} else {
component.descriptiveIconModel = .init(name: iconName,
size: iconSize)
}
let iconColor: Tilelet.IconColor = colorPickerType == .token ? .token(token) : .custom(custom)
component.descriptiveIconModel = .init(name: iconName, iconColor: iconColor, size: iconSize)
}
func setDirectionalIconModel() {
@ -620,12 +618,8 @@ class TileletViewController: BaseViewController<Tilelet> {
let token = directionalIconTokenColorView.selectedItem
let iconType = directionIconPickerSelectorView.selectedItem
let iconSize = directionIconSizePickerSelectorView.selectedItem
if let iconColor {
component.directionalIconModel = .init(iconType: iconType, iconColor: iconColor, size: iconSize)
} else {
component.directionalIconModel = .init(iconType: iconType, size: iconSize)
}
let iconColor: Tilelet.IconColor = colorPickerType == .token ? .token(token) : .custom(custom)
component.directionalIconModel = .init(iconType: iconType, iconColor: iconColor, size: iconSize)
}
func updateOtherTextStyles() {
@ -731,6 +725,11 @@ class TileletViewController: BaseViewController<Tilelet> {
self?.setDescriptiveIconModel()
}
descriptionIconTokenColorView.onPickerDidSelect = { [weak self] item in
self?.colorPickerType = .token
self?.setDescriptiveIconModel()
}
directionIconPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.setDirectionalIconModel()
}
@ -738,6 +737,11 @@ class TileletViewController: BaseViewController<Tilelet> {
directionIconSizePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.setDirectionalIconModel()
}
directionalIconTokenColorView.onPickerDidSelect = { [weak self] item in
self?.colorPickerType = .token
self?.setDirectionalIconModel()
}
}
func getTilelet(effect: TileContainer.BackgroundEffect) -> Tilelet.BackgroundEffect {
@ -810,7 +814,6 @@ extension TileletViewController: UIColorPickerViewControllerDelegate {
case .gradientColor2:
gradientColorView2.selectedColor = viewController.selectedColor
updateGradientColors()
case .custom:
var colorView: ColorPickerView<ColorPickerType>
@ -839,7 +842,9 @@ extension TileletViewController: UIColorPickerViewControllerDelegate {
setDirectionalIconModel()
case .descriptionIcon:
setDescriptiveIconModel()
}
}
default:
break
}
}