updated example

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-05-23 08:47:51 -05:00
parent 34cf1d979b
commit 7ac348676b

View File

@ -178,6 +178,18 @@ class TileletViewController: BaseViewController<Tilelet> {
} }
}() }()
lazy var descriptionNamePickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: Icon.Name.all.sorted{ $0.rawValue < $1.rawValue })
}()
lazy var descriptionIconSizePickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: Icon.Size.allCases)
}()
lazy var descriptionIconLightColorView: ColorPickerView<ColorPickerType> = { lazy var descriptionIconLightColorView: ColorPickerView<ColorPickerType> = {
return .init(with: ColorPickerType.light) { [weak self] picker in return .init(with: ColorPickerType.light) { [weak self] picker in
self?.currentSurfaceColorType = .descriptionIcon self?.currentSurfaceColorType = .descriptionIcon
@ -326,6 +338,8 @@ class TileletViewController: BaseViewController<Tilelet> {
$0.addFormRow(label: "Show", view: showDescriptionIconSwitch) $0.addFormRow(label: "Show", view: showDescriptionIconSwitch)
})) }))
append(section: descriptionIconFormStackView) append(section: descriptionIconFormStackView)
descriptionIconFormStackView.addFormRow(label: "Icon", view: descriptionNamePickerSelectorView)
descriptionIconFormStackView.addFormRow(label: "Size", view: descriptionIconSizePickerSelectorView)
descriptionIconFormStackView.addFormRow(label: "Light", view: descriptionIconLightColorView) descriptionIconFormStackView.addFormRow(label: "Light", view: descriptionIconLightColorView)
descriptionIconFormStackView.addFormRow(label: "Dark", view: descriptionIconDarkColorView) descriptionIconFormStackView.addFormRow(label: "Dark", view: descriptionIconDarkColorView)
@ -496,6 +510,16 @@ class TileletViewController: BaseViewController<Tilelet> {
textPositionPickerSelectorView.text = component.textPostion.rawValue textPositionPickerSelectorView.text = component.textPostion.rawValue
scalingTypePickerSelectorView.text = component.aspectRatio.rawValue scalingTypePickerSelectorView.text = component.aspectRatio.rawValue
updateOtherTextStyles() updateOtherTextStyles()
descriptionIconLightColorView.selectedColor = VDSColor.elementsPrimaryOnlight
descriptionIconDarkColorView.selectedColor = VDSColor.elementsPrimaryOndark
descriptionNamePickerSelectorView.text = Icon.Name.multipleDocuments.rawValue
descriptionIconSizePickerSelectorView.text = Icon.Size.medium.rawValue
directionalIconLightColorView.selectedColor = VDSColor.elementsPrimaryOnlight
directionalIconDarkColorView.selectedColor = VDSColor.elementsPrimaryOndark
directionIconPickerSelectorView.text = Tilelet.DirectionalIcon.IconType.rightArrow.rawValue
directionIconSizePickerSelectorView.text = Tilelet.DirectionalIcon.IconSize.medium.rawValue
} }
//sub models //sub models
@ -577,11 +601,15 @@ class TileletViewController: BaseViewController<Tilelet> {
func setDescriptiveIconModel() { func setDescriptiveIconModel() {
let light = descriptionIconLightColorView.selectedColor ?? descriptionIconDarkColorView.selectedColor let light = descriptionIconLightColorView.selectedColor ?? descriptionIconDarkColorView.selectedColor
let dark = descriptionIconDarkColorView.selectedColor ?? descriptionIconLightColorView.selectedColor let dark = descriptionIconDarkColorView.selectedColor ?? descriptionIconLightColorView.selectedColor
let iconSize = descriptionIconSizePickerSelectorView.selectedItem
let iconName = descriptionNamePickerSelectorView.selectedItem
if let light, let dark { if let light, let dark {
component.descriptiveIconModel = .init(colorConfiguration: SurfaceColorConfiguration(light, dark), size: .medium) component.descriptiveIconModel = .init(name: iconName,
colorConfiguration: SurfaceColorConfiguration(light, dark), size: iconSize)
} else { } else {
component.descriptiveIconModel = .init(size: .medium) component.descriptiveIconModel = .init(name: iconName,
size: iconSize)
} }
} }
@ -693,6 +721,14 @@ class TileletViewController: BaseViewController<Tilelet> {
} }
} }
descriptionNamePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.setDescriptiveIconModel()
}
descriptionIconSizePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.setDescriptiveIconModel()
}
directionIconPickerSelectorView.onPickerDidSelect = { [weak self] item in directionIconPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.setDirectionalIconModel() self?.setDirectionalIconModel()
} }