refactored
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
76ac67a4aa
commit
2b582cd39c
@ -72,7 +72,7 @@ public class TokenColorPickerSection<EnumType: RawRepresentable & CaseIterable>:
|
|||||||
public var selectedItem: EnumType { pickerSelectorView.selectedItem }
|
public var selectedItem: EnumType { pickerSelectorView.selectedItem }
|
||||||
|
|
||||||
/// Callback for a non-token/non-color selection
|
/// Callback for a non-token/non-color selection
|
||||||
public var onOtherSelected: ((EnumType) -> Void)?
|
public var onSelected: ((EnumType) -> Void)?
|
||||||
/// Callback after "token" is selected from the VDSColor array
|
/// Callback after "token" is selected from the VDSColor array
|
||||||
public var onTokenSelected: ((UIColor.VDSColor) -> Void)?
|
public var onTokenSelected: ((UIColor.VDSColor) -> Void)?
|
||||||
/// Callback once the user picks a color from the picker.
|
/// Callback once the user picks a color from the picker.
|
||||||
@ -110,7 +110,7 @@ public class TokenColorPickerSection<EnumType: RawRepresentable & CaseIterable>:
|
|||||||
} else if let selectedItem = customColorView.selectedColor, isCustom {
|
} else if let selectedItem = customColorView.selectedColor, isCustom {
|
||||||
onColorSelected?(selectedItem)
|
onColorSelected?(selectedItem)
|
||||||
} else {
|
} else {
|
||||||
onOtherSelected?(item)
|
onSelected?(item)
|
||||||
}
|
}
|
||||||
tokenColorRow?.isHidden = !isToken
|
tokenColorRow?.isHidden = !isToken
|
||||||
customColorRow?.isHidden = !isCustom
|
customColorRow?.isHidden = !isCustom
|
||||||
|
|||||||
@ -63,7 +63,7 @@ class BadgeViewController: BaseViewController<Badge> {
|
|||||||
|
|
||||||
lazy var fillColorSection = {
|
lazy var fillColorSection = {
|
||||||
TokenColorPickerSection<FillColor>(rowTitle: "Fill Color", picker: self.picker).with {
|
TokenColorPickerSection<FillColor>(rowTitle: "Fill Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
var fillColor: Badge.FillColor = .red
|
var fillColor: Badge.FillColor = .red
|
||||||
switch item {
|
switch item {
|
||||||
@ -99,7 +99,7 @@ class BadgeViewController: BaseViewController<Badge> {
|
|||||||
|
|
||||||
lazy var textColorSection = {
|
lazy var textColorSection = {
|
||||||
TokenColorPickerSection<TextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
TokenColorPickerSection<TextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
component.textColor = nil
|
component.textColor = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,7 +130,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var badgeFillColor: Badge.FillColor = .red { didSet { setBadgeModel() } }
|
var badgeFillColor: Badge.FillColor = .red { didSet { setBadgeModel() } }
|
||||||
lazy var badgeFillColorSection = {
|
lazy var badgeFillColorSection = {
|
||||||
TokenColorPickerSection<BadgeFillColor>(rowTitle: "Fill Color", picker: self.picker).with {
|
TokenColorPickerSection<BadgeFillColor>(rowTitle: "Fill Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
var fillColor: Badge.FillColor = .red
|
var fillColor: Badge.FillColor = .red
|
||||||
switch item {
|
switch item {
|
||||||
@ -167,7 +167,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var badgeTextColor: Badge.TextColor? { didSet { setBadgeModel() } }
|
var badgeTextColor: Badge.TextColor? { didSet { setBadgeModel() } }
|
||||||
lazy var badgeTextColorSection = {
|
lazy var badgeTextColorSection = {
|
||||||
TokenColorPickerSection<BadgeTextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
TokenColorPickerSection<BadgeTextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
badgeTextColor = nil
|
badgeTextColor = nil
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var eyeBrowTextColor: TitleLockup.TextColor = .primary { didSet { setEyebrowModel() } }
|
var eyeBrowTextColor: TitleLockup.TextColor = .primary { didSet { setEyebrowModel() } }
|
||||||
lazy var eyebrowTextColorFormSection = {
|
lazy var eyebrowTextColorFormSection = {
|
||||||
TokenColorPickerSection<TextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
TokenColorPickerSection<TextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .primary:
|
case .primary:
|
||||||
@ -228,7 +228,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var subtitleTextColor: TitleLockup.TextColor = .primary { didSet { setSubTitleModel() } }
|
var subtitleTextColor: TitleLockup.TextColor = .primary { didSet { setSubTitleModel() } }
|
||||||
lazy var subTitleTextColorFormSection = {
|
lazy var subTitleTextColorFormSection = {
|
||||||
TokenColorPickerSection<TextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
TokenColorPickerSection<TextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .primary:
|
case .primary:
|
||||||
@ -252,7 +252,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var titleTextColor: TitleLockup.TitleTextColor = .primary { didSet { setTitleModel() } }
|
var titleTextColor: TitleLockup.TitleTextColor = .primary { didSet { setTitleModel() } }
|
||||||
lazy var titleTextColorFormSection = {
|
lazy var titleTextColorFormSection = {
|
||||||
TokenColorPickerSection<TitleTextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
TokenColorPickerSection<TitleTextColor>(rowTitle: "Text Color", picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .primary:
|
case .primary:
|
||||||
@ -288,7 +288,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var descriptionIconColor: Tilelet.IconColor? = .token(.paletteWhite) { didSet { setDescriptiveIconModel() } }
|
var descriptionIconColor: Tilelet.IconColor? = .token(.paletteWhite) { didSet { setDescriptiveIconModel() } }
|
||||||
lazy var descriptionIconColorFormSection = {
|
lazy var descriptionIconColorFormSection = {
|
||||||
TokenColorPickerSection<IconColor>(picker: self.picker).with {
|
TokenColorPickerSection<IconColor>(picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .default:
|
case .default:
|
||||||
@ -325,7 +325,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
var directionIconColor: Tilelet.IconColor? = .token(.paletteWhite) { didSet { setDirectionalIconModel() } }
|
var directionIconColor: Tilelet.IconColor? = .token(.paletteWhite) { didSet { setDirectionalIconModel() } }
|
||||||
lazy var directionIconColorFormSection = {
|
lazy var directionIconColorFormSection = {
|
||||||
TokenColorPickerSection<IconColor>(picker: self.picker).with {
|
TokenColorPickerSection<IconColor>(picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .default:
|
case .default:
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
lazy var eyebrowTextColorFormSection = {
|
lazy var eyebrowTextColorFormSection = {
|
||||||
TokenColorPickerSection<TextColor>(rowTitle: "Text Color",
|
TokenColorPickerSection<TextColor>(rowTitle: "Text Color",
|
||||||
picker: self.picker).with {
|
picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .primary:
|
case .primary:
|
||||||
@ -74,7 +74,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
lazy var subTitleTextColorFormSection = {
|
lazy var subTitleTextColorFormSection = {
|
||||||
TokenColorPickerSection<TextColor>(rowTitle: "Text Color",
|
TokenColorPickerSection<TextColor>(rowTitle: "Text Color",
|
||||||
picker: self.picker).with {
|
picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .primary:
|
case .primary:
|
||||||
@ -99,7 +99,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
lazy var titleTextColorFormSection = {
|
lazy var titleTextColorFormSection = {
|
||||||
TokenColorPickerSection<TitleTextColor>(rowTitle: "Text Color",
|
TokenColorPickerSection<TitleTextColor>(rowTitle: "Text Color",
|
||||||
picker: self.picker).with {
|
picker: self.picker).with {
|
||||||
$0.onOtherSelected = { [weak self] item in
|
$0.onSelected = { [weak self] item in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch item {
|
switch item {
|
||||||
case .primary:
|
case .primary:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user