fixed titlelockup sample

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-06-05 13:04:31 -05:00
parent 28caf2e27d
commit 714fb541bd
2 changed files with 21 additions and 18 deletions

View File

@ -31,9 +31,12 @@ public class ColorPickerView<EnumType>: UIStackView {
$0.text = "Select"
}
public init(with pickerType: EnumType, onClick: @escaping (ColorPickerView)->Void) {
public init(with pickerType: EnumType, color: UIColor? = nil, onClick: @escaping (ColorPickerView)->Void) {
self.pickerType = pickerType
super.init(frame: .zero)
if let color {
selectedColor = color
}
setup()
button.onClick = { _ in onClick(self) }
}

View File

@ -128,13 +128,14 @@ class TileletViewController: BaseViewController<Tilelet> {
}()
lazy var eyebrowTokenColorView = {
PickerSelectorView(title: "paletteBlack",
PickerSelectorView(title: "",
picker: self.picker,
items: UIColor.VDSColor.allCases)
.with { $0.text = UIColor.VDSColor.paletteWhite.rawValue }
}()
lazy var eyebrowCustomColorView: ColorPickerView<ColorPickerType> = {
return .init(with: ColorPickerType.custom) { [weak self] picker in
return .init(with: ColorPickerType.custom, color: .white) { [weak self] picker in
self?.currentSurfaceColorType = .eyebrow
self?.colorPickerType = picker.pickerType
self?.selectedColorTapped(picker)
@ -150,13 +151,15 @@ class TileletViewController: BaseViewController<Tilelet> {
items: TitleTextColor.allCases)
}()
lazy var titleTokenColorView = {
PickerSelectorView(title: "paletteBlack",
PickerSelectorView(title: "",
picker: self.picker,
items: UIColor.VDSColor.allCases)
.with { $0.text = UIColor.VDSColor.paletteWhite.rawValue }
}()
lazy var titleCustomColorView: ColorPickerView<ColorPickerType> = {
return .init(with: ColorPickerType.custom) { [weak self] picker in
return .init(with: ColorPickerType.custom, color: .white) { [weak self] picker in
self?.currentSurfaceColorType = .title
self?.colorPickerType = picker.pickerType
self?.selectedColorTapped(picker)
@ -172,13 +175,14 @@ class TileletViewController: BaseViewController<Tilelet> {
items: TextColor.allCases)
}()
lazy var subtitleTokenColorView = {
PickerSelectorView(title: "paletteBlack",
PickerSelectorView(title: "",
picker: self.picker,
items: UIColor.VDSColor.allCases)
.with { $0.text = UIColor.VDSColor.paletteWhite.rawValue }
}()
lazy var subtitleCustomColorView: ColorPickerView<ColorPickerType> = {
return .init(with: ColorPickerType.custom) { [weak self] picker in
return .init(with: ColorPickerType.custom, color: .white) { [weak self] picker in
self?.currentSurfaceColorType = .subtitle
self?.colorPickerType = picker.pickerType
self?.selectedColorTapped(picker)
@ -208,9 +212,10 @@ class TileletViewController: BaseViewController<Tilelet> {
}()
lazy var descriptionIconTokenColorView = {
PickerSelectorView(title: "paletteBlack",
PickerSelectorView(title: "",
picker: self.picker,
items: UIColor.VDSColor.allCases)
.with { $0.text = UIColor.VDSColor.paletteWhite.rawValue }
}()
lazy var descriptionIconCustomColorView: ColorPickerView<ColorPickerType> = {
@ -240,9 +245,10 @@ class TileletViewController: BaseViewController<Tilelet> {
}()
lazy var directionalIconTokenColorView = {
PickerSelectorView(title: "paletteBlack",
PickerSelectorView(title: "",
picker: self.picker,
items: UIColor.VDSColor.allCases)
.with { $0.text = UIColor.VDSColor.paletteWhite.rawValue }
}()
lazy var directionalIconCustomColorView: ColorPickerView<ColorPickerType> = {
@ -783,9 +789,7 @@ class TileletViewController: BaseViewController<Tilelet> {
self?.currentSurfaceColorType = .eyebrow
self?.eyebrowTokenFormStackView.isHidden = item != .token
self?.eyebrowColorFormStackView.isHidden = item != .custom
if item != .custom && item != .token {
self?.setEyebrowModel()
}
self?.setEyebrowModel()
}
eyebrowTokenColorView.onPickerDidSelect = { [weak self] item in
@ -796,9 +800,7 @@ class TileletViewController: BaseViewController<Tilelet> {
self?.currentSurfaceColorType = .title
self?.titleTokenFormStackView.isHidden = item != .token
self?.titleColorFormStackView.isHidden = item != .custom
if item != .custom && item != .token {
self?.setTitleModel()
}
self?.setTitleModel()
}
titleTokenColorView.onPickerDidSelect = { [weak self] item in
@ -809,9 +811,7 @@ class TileletViewController: BaseViewController<Tilelet> {
self?.currentSurfaceColorType = .subtitle
self?.subtitleTokenFormStackView.isHidden = item != .token
self?.subtitleColorFormStackView.isHidden = item != .custom
if item != .custom && item != .token {
self?.setSubTitleModel()
}
self?.setSubTitleModel()
}
subtitleTokenColorView.onPickerDidSelect = { [weak self] item in