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 }
|
||||
|
||||
/// 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
|
||||
public var onTokenSelected: ((UIColor.VDSColor) -> Void)?
|
||||
/// 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 {
|
||||
onColorSelected?(selectedItem)
|
||||
} else {
|
||||
onOtherSelected?(item)
|
||||
onSelected?(item)
|
||||
}
|
||||
tokenColorRow?.isHidden = !isToken
|
||||
customColorRow?.isHidden = !isCustom
|
||||
|
||||
@ -63,7 +63,7 @@ class BadgeViewController: BaseViewController<Badge> {
|
||||
|
||||
lazy var fillColorSection = {
|
||||
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 }
|
||||
var fillColor: Badge.FillColor = .red
|
||||
switch item {
|
||||
@ -99,7 +99,7 @@ class BadgeViewController: BaseViewController<Badge> {
|
||||
|
||||
lazy var textColorSection = {
|
||||
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 }
|
||||
component.textColor = nil
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var badgeFillColor: Badge.FillColor = .red { didSet { setBadgeModel() } }
|
||||
lazy var badgeFillColorSection = {
|
||||
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 }
|
||||
var fillColor: Badge.FillColor = .red
|
||||
switch item {
|
||||
@ -167,7 +167,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var badgeTextColor: Badge.TextColor? { didSet { setBadgeModel() } }
|
||||
lazy var badgeTextColorSection = {
|
||||
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 }
|
||||
badgeTextColor = nil
|
||||
}
|
||||
@ -204,7 +204,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var eyeBrowTextColor: TitleLockup.TextColor = .primary { didSet { setEyebrowModel() } }
|
||||
lazy var eyebrowTextColorFormSection = {
|
||||
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 }
|
||||
switch item {
|
||||
case .primary:
|
||||
@ -228,7 +228,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var subtitleTextColor: TitleLockup.TextColor = .primary { didSet { setSubTitleModel() } }
|
||||
lazy var subTitleTextColorFormSection = {
|
||||
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 }
|
||||
switch item {
|
||||
case .primary:
|
||||
@ -252,7 +252,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var titleTextColor: TitleLockup.TitleTextColor = .primary { didSet { setTitleModel() } }
|
||||
lazy var titleTextColorFormSection = {
|
||||
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 }
|
||||
switch item {
|
||||
case .primary:
|
||||
@ -288,7 +288,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var descriptionIconColor: Tilelet.IconColor? = .token(.paletteWhite) { didSet { setDescriptiveIconModel() } }
|
||||
lazy var descriptionIconColorFormSection = {
|
||||
TokenColorPickerSection<IconColor>(picker: self.picker).with {
|
||||
$0.onOtherSelected = { [weak self] item in
|
||||
$0.onSelected = { [weak self] item in
|
||||
guard let self else { return }
|
||||
switch item {
|
||||
case .default:
|
||||
@ -325,7 +325,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
||||
var directionIconColor: Tilelet.IconColor? = .token(.paletteWhite) { didSet { setDirectionalIconModel() } }
|
||||
lazy var directionIconColorFormSection = {
|
||||
TokenColorPickerSection<IconColor>(picker: self.picker).with {
|
||||
$0.onOtherSelected = { [weak self] item in
|
||||
$0.onSelected = { [weak self] item in
|
||||
guard let self else { return }
|
||||
switch item {
|
||||
case .default:
|
||||
|
||||
@ -49,7 +49,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
||||
lazy var eyebrowTextColorFormSection = {
|
||||
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 }
|
||||
switch item {
|
||||
case .primary:
|
||||
@ -74,7 +74,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
||||
lazy var subTitleTextColorFormSection = {
|
||||
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 }
|
||||
switch item {
|
||||
case .primary:
|
||||
@ -99,7 +99,7 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
||||
lazy var titleTextColorFormSection = {
|
||||
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 }
|
||||
switch item {
|
||||
case .primary:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user