more tilelet changes
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a2a81e85a4
commit
34cf1d979b
@ -12,7 +12,7 @@ import VDSTokens
|
||||
import Combine
|
||||
|
||||
class TileletViewController: BaseViewController<Tilelet> {
|
||||
|
||||
|
||||
lazy var titleStandardStylePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
@ -186,6 +186,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
}
|
||||
}()
|
||||
|
||||
var descriptionIconFormStackView = FormSection().with { $0.isHidden = true }
|
||||
lazy var descriptionIconDarkColorView: ColorPickerView<ColorPickerType> = {
|
||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
||||
self?.currentSurfaceColorType = .descriptionIcon
|
||||
@ -194,6 +195,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
}
|
||||
}()
|
||||
|
||||
var directionalIconFormStackView = FormSection().with { $0.isHidden = true }
|
||||
lazy var directionalIconLightColorView: ColorPickerView<ColorPickerType> = {
|
||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
||||
self?.currentSurfaceColorType = .directionalIcon
|
||||
@ -210,6 +212,18 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
}
|
||||
}()
|
||||
|
||||
lazy var directionIconPickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: Tilelet.DirectionalIcon.IconType.allCases.sorted{ $0.rawValue < $1.rawValue })
|
||||
}()
|
||||
|
||||
lazy var directionIconSizePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: Tilelet.DirectionalIcon.IconSize.allCases.sorted{ $0.rawValue < $1.rawValue })
|
||||
}()
|
||||
|
||||
let backgroundImage = UIImage(named: "backgroundTest")!
|
||||
var clickableSwitch = Toggle()
|
||||
var eyebrowTextField = TextField()
|
||||
@ -308,16 +322,23 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
append(section: subtitleColorsFormStackView)
|
||||
|
||||
append(section: .init().with({
|
||||
$0.title = "Icons"
|
||||
$0.addFormRow(label: "Description", view: showDescriptionIconSwitch)
|
||||
$0.addFormRow(label: "Light", view: descriptionIconLightColorView)
|
||||
$0.addFormRow(label: "Dark", view: descriptionIconDarkColorView)
|
||||
|
||||
$0.addFormRow(label: "Directional", view: showDirectionalIconSwitch)
|
||||
$0.addFormRow(label: "Light", view: directionalIconLightColorView)
|
||||
$0.addFormRow(label: "Dark", view: directionalIconDarkColorView)
|
||||
$0.title = "Description Icon "
|
||||
$0.addFormRow(label: "Show", view: showDescriptionIconSwitch)
|
||||
}))
|
||||
append(section: descriptionIconFormStackView)
|
||||
descriptionIconFormStackView.addFormRow(label: "Light", view: descriptionIconLightColorView)
|
||||
descriptionIconFormStackView.addFormRow(label: "Dark", view: descriptionIconDarkColorView)
|
||||
|
||||
append(section: .init().with({
|
||||
$0.title = "Directional Icon"
|
||||
$0.addFormRow(label: "Show", view: showDirectionalIconSwitch)
|
||||
}))
|
||||
append(section: directionalIconFormStackView)
|
||||
directionalIconFormStackView.addFormRow(label: "Icon", view: directionIconPickerSelectorView)
|
||||
directionalIconFormStackView.addFormRow(label: "Size", view: directionIconSizePickerSelectorView)
|
||||
directionalIconFormStackView.addFormRow(label: "Light", view: directionalIconLightColorView)
|
||||
directionalIconFormStackView.addFormRow(label: "Dark", view: directionalIconDarkColorView)
|
||||
|
||||
clickableSwitch.onChange = { [weak self] sender in
|
||||
guard let self else { return }
|
||||
if sender.isOn {
|
||||
@ -393,6 +414,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
}.store(in: &subscribers)
|
||||
|
||||
showDescriptionIconSwitch.onChange = { [weak self] sender in
|
||||
self?.descriptionIconFormStackView.isHidden = !sender.isOn
|
||||
self?.directionalIconFormStackView.isHidden = sender.isOn
|
||||
if sender.isOn {
|
||||
self?.showDirectionalIconSwitch.isOn = false
|
||||
self?.setDescriptiveIconModel()
|
||||
@ -402,6 +425,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
}
|
||||
|
||||
showDirectionalIconSwitch.onChange = { [weak self] sender in
|
||||
self?.descriptionIconFormStackView.isHidden = sender.isOn
|
||||
self?.directionalIconFormStackView.isHidden = !sender.isOn
|
||||
if sender.isOn {
|
||||
self?.showDescriptionIconSwitch.isOn = false
|
||||
self?.setDirectionalIconModel()
|
||||
@ -563,11 +588,13 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
func setDirectionalIconModel() {
|
||||
let light = directionalIconLightColorView.selectedColor ?? directionalIconDarkColorView.selectedColor
|
||||
let dark = directionalIconDarkColorView.selectedColor ?? directionalIconLightColorView.selectedColor
|
||||
|
||||
let iconType = directionIconPickerSelectorView.selectedItem
|
||||
let iconSize = directionIconSizePickerSelectorView.selectedItem
|
||||
|
||||
if let light, let dark {
|
||||
component.directionalIconModel = .init(colorConfiguration: SurfaceColorConfiguration(light, dark), size: .medium)
|
||||
component.directionalIconModel = .init(iconType: iconType, colorConfiguration: SurfaceColorConfiguration(light, dark), size: iconSize)
|
||||
} else {
|
||||
component.directionalIconModel = .init(size: .medium)
|
||||
component.directionalIconModel = .init(iconType: iconType, size: iconSize)
|
||||
}
|
||||
}
|
||||
|
||||
@ -666,6 +693,13 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
}
|
||||
}
|
||||
|
||||
directionIconPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.setDirectionalIconModel()
|
||||
}
|
||||
|
||||
directionIconSizePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.setDirectionalIconModel()
|
||||
}
|
||||
}
|
||||
|
||||
func getTilelet(effect: TileContainer.BackgroundEffect) -> Tilelet.BackgroundEffect {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user