initial cut
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
31abec0529
commit
c344d0196b
@ -71,7 +71,7 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
enum ColorPickerType {
|
enum ColorPickerType {
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case gradientColor1, gradientColor2
|
case gradientColor1, gradientColor2
|
||||||
case contentViewBackgroundColor, light, dark
|
case contentViewBackgroundColor, custom
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy var gradientColorView1: ColorPickerView<ColorPickerType> = {
|
lazy var gradientColorView1: ColorPickerView<ColorPickerType> = {
|
||||||
@ -107,11 +107,11 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum TitleTextColor: String, CaseIterable {
|
enum TitleTextColor: String, CaseIterable {
|
||||||
case primary, custom
|
case primary, token, custom
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TextColor: String, CaseIterable {
|
enum TextColor: String, CaseIterable {
|
||||||
case primary, secondary, custom
|
case primary, secondary, token, custom
|
||||||
}
|
}
|
||||||
|
|
||||||
/// eyebrow
|
/// eyebrow
|
||||||
@ -122,15 +122,15 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
items: TextColor.allCases)
|
items: TextColor.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var eyebrowLightColorView: ColorPickerView<ColorPickerType> = {
|
lazy var eyebrowTokenColorView = {
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
self?.colorPickerType = picker.pickerType
|
picker: self.picker,
|
||||||
self?.selectedColorTapped(picker)
|
items: UIColor.VDSColor.allCases)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var eyebrowDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var eyebrowCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
|
self?.currentSurfaceColorType = .eyebrow
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
@ -143,15 +143,15 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
items: TitleTextColor.allCases)
|
items: TitleTextColor.allCases)
|
||||||
}()
|
}()
|
||||||
lazy var titleLightColorView: ColorPickerView<ColorPickerType> = {
|
lazy var titleTokenColorView = {
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
self?.colorPickerType = picker.pickerType
|
picker: self.picker,
|
||||||
self?.selectedColorTapped(picker)
|
items: UIColor.VDSColor.allCases)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var titleDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var titleCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
|
self?.currentSurfaceColorType = .title
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
@ -164,20 +164,21 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
items: TextColor.allCases)
|
items: TextColor.allCases)
|
||||||
}()
|
}()
|
||||||
lazy var subtitleLightColorView: ColorPickerView<ColorPickerType> = {
|
lazy var subtitleTokenColorView = {
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
self?.colorPickerType = picker.pickerType
|
picker: self.picker,
|
||||||
self?.selectedColorTapped(picker)
|
items: UIColor.VDSColor.allCases)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var subtitleDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var subtitleCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
|
self?.currentSurfaceColorType = .subtitle
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
var descriptionIconFormStackView = FormSection().with { $0.isHidden = true }
|
||||||
lazy var descriptionNamePickerSelectorView = {
|
lazy var descriptionNamePickerSelectorView = {
|
||||||
PickerSelectorView(title: "",
|
PickerSelectorView(title: "",
|
||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
@ -190,34 +191,35 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
items: Icon.Size.allCases)
|
items: Icon.Size.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var descriptionIconLightColorView: ColorPickerView<ColorPickerType> = {
|
lazy var descriptionIconTokenColorView = {
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
|
picker: self.picker,
|
||||||
|
items: UIColor.VDSColor.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
|
lazy var descriptionIconCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
self?.currentSurfaceColorType = .descriptionIcon
|
self?.currentSurfaceColorType = .descriptionIcon
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var descriptionIconFormStackView = FormSection().with { $0.isHidden = true }
|
|
||||||
lazy var descriptionIconDarkColorView: ColorPickerView<ColorPickerType> = {
|
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
|
||||||
self?.currentSurfaceColorType = .descriptionIcon
|
|
||||||
self?.colorPickerType = picker.pickerType
|
|
||||||
self?.selectedColorTapped(picker)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
var directionalIconFormStackView = FormSection().with { $0.isHidden = true }
|
var directionalIconFormStackView = FormSection().with { $0.isHidden = true }
|
||||||
lazy var directionalIconLightColorView: ColorPickerView<ColorPickerType> = {
|
lazy var directionalIconSizePickerSelectorView = {
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
PickerSelectorView(title: "",
|
||||||
self?.currentSurfaceColorType = .directionalIcon
|
picker: self.picker,
|
||||||
self?.colorPickerType = picker.pickerType
|
items: Icon.Size.allCases)
|
||||||
self?.selectedColorTapped(picker)
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var directionalIconDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var directionalIconTokenColorView = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
|
picker: self.picker,
|
||||||
|
items: UIColor.VDSColor.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
|
lazy var directionalIconCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
self?.currentSurfaceColorType = .directionalIcon
|
self?.currentSurfaceColorType = .directionalIcon
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
@ -309,8 +311,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
$0.addFormRow(label: "Color", view: eyebrowColorPickerSelectorView)
|
$0.addFormRow(label: "Color", view: eyebrowColorPickerSelectorView)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
eyebrowColorsFormStackView.addFormRow(label: "Light", view: eyebrowLightColorView)
|
eyebrowColorsFormStackView.addFormRow(label: "Token", view: eyebrowTokenColorView)
|
||||||
eyebrowColorsFormStackView.addFormRow(label: "Dark", view: eyebrowDarkColorView)
|
eyebrowColorsFormStackView.addFormRow(label: "Custom", view: eyebrowCustomColorView)
|
||||||
append(section: eyebrowColorsFormStackView)
|
append(section: eyebrowColorsFormStackView)
|
||||||
|
|
||||||
append(section: .init().with({
|
append(section: .init().with({
|
||||||
@ -320,8 +322,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
$0.addFormRow(label: "Text", view: titleTextField)
|
$0.addFormRow(label: "Text", view: titleTextField)
|
||||||
$0.addFormRow(label: "Color", view: titleColorPickerSelectorView)
|
$0.addFormRow(label: "Color", view: titleColorPickerSelectorView)
|
||||||
}))
|
}))
|
||||||
titleColorsFormStackView.addFormRow(label: "Light", view: titleLightColorView)
|
titleColorsFormStackView.addFormRow(label: "Token", view: titleTokenColorView)
|
||||||
titleColorsFormStackView.addFormRow(label: "Dark", view: titleDarkColorView)
|
titleColorsFormStackView.addFormRow(label: "Custom", view: titleCustomColorView)
|
||||||
append(section: titleColorsFormStackView)
|
append(section: titleColorsFormStackView)
|
||||||
|
|
||||||
append(section: .init().with({
|
append(section: .init().with({
|
||||||
@ -329,8 +331,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
$0.addFormRow(label: "Text", view: subTitleTextField)
|
$0.addFormRow(label: "Text", view: subTitleTextField)
|
||||||
$0.addFormRow(label: "Color", view: subtitleColorPickerSelectorView)
|
$0.addFormRow(label: "Color", view: subtitleColorPickerSelectorView)
|
||||||
}))
|
}))
|
||||||
subtitleColorsFormStackView.addFormRow(label: "Light", view: subtitleLightColorView)
|
subtitleColorsFormStackView.addFormRow(label: "Token", view: subtitleTokenColorView)
|
||||||
subtitleColorsFormStackView.addFormRow(label: "Dark", view: subtitleDarkColorView)
|
subtitleColorsFormStackView.addFormRow(label: "Custom", view: subtitleCustomColorView)
|
||||||
append(section: subtitleColorsFormStackView)
|
append(section: subtitleColorsFormStackView)
|
||||||
|
|
||||||
append(section: .init().with({
|
append(section: .init().with({
|
||||||
@ -340,8 +342,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
append(section: descriptionIconFormStackView)
|
append(section: descriptionIconFormStackView)
|
||||||
descriptionIconFormStackView.addFormRow(label: "Icon", view: descriptionNamePickerSelectorView)
|
descriptionIconFormStackView.addFormRow(label: "Icon", view: descriptionNamePickerSelectorView)
|
||||||
descriptionIconFormStackView.addFormRow(label: "Size", view: descriptionIconSizePickerSelectorView)
|
descriptionIconFormStackView.addFormRow(label: "Size", view: descriptionIconSizePickerSelectorView)
|
||||||
descriptionIconFormStackView.addFormRow(label: "Light", view: descriptionIconLightColorView)
|
descriptionIconFormStackView.addFormRow(label: "Token", view: descriptionIconTokenColorView)
|
||||||
descriptionIconFormStackView.addFormRow(label: "Dark", view: descriptionIconDarkColorView)
|
descriptionIconFormStackView.addFormRow(label: "Custom", view: descriptionIconCustomColorView)
|
||||||
|
|
||||||
append(section: .init().with({
|
append(section: .init().with({
|
||||||
$0.title = "Directional Icon"
|
$0.title = "Directional Icon"
|
||||||
@ -350,8 +352,8 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
append(section: directionalIconFormStackView)
|
append(section: directionalIconFormStackView)
|
||||||
directionalIconFormStackView.addFormRow(label: "Icon", view: directionIconPickerSelectorView)
|
directionalIconFormStackView.addFormRow(label: "Icon", view: directionIconPickerSelectorView)
|
||||||
directionalIconFormStackView.addFormRow(label: "Size", view: directionIconSizePickerSelectorView)
|
directionalIconFormStackView.addFormRow(label: "Size", view: directionIconSizePickerSelectorView)
|
||||||
directionalIconFormStackView.addFormRow(label: "Light", view: directionalIconLightColorView)
|
directionalIconFormStackView.addFormRow(label: "Token", view: directionalIconTokenColorView)
|
||||||
directionalIconFormStackView.addFormRow(label: "Dark", view: directionalIconDarkColorView)
|
directionalIconFormStackView.addFormRow(label: "Dark", view: directionalIconCustomColorView)
|
||||||
|
|
||||||
clickableSwitch.onChange = { [weak self] sender in
|
clickableSwitch.onChange = { [weak self] sender in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
@ -511,13 +513,11 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
scalingTypePickerSelectorView.text = component.aspectRatio.rawValue
|
scalingTypePickerSelectorView.text = component.aspectRatio.rawValue
|
||||||
updateOtherTextStyles()
|
updateOtherTextStyles()
|
||||||
|
|
||||||
descriptionIconLightColorView.selectedColor = VDSColor.elementsPrimaryOnlight
|
descriptionIconCustomColorView.selectedColor = VDSColor.elementsPrimaryOnlight
|
||||||
descriptionIconDarkColorView.selectedColor = VDSColor.elementsPrimaryOndark
|
|
||||||
descriptionNamePickerSelectorView.text = Icon.Name.multipleDocuments.rawValue
|
descriptionNamePickerSelectorView.text = Icon.Name.multipleDocuments.rawValue
|
||||||
descriptionIconSizePickerSelectorView.text = Icon.Size.medium.rawValue
|
descriptionIconSizePickerSelectorView.text = Icon.Size.medium.rawValue
|
||||||
|
|
||||||
directionalIconLightColorView.selectedColor = VDSColor.elementsPrimaryOnlight
|
directionalIconCustomColorView.selectedColor = VDSColor.elementsPrimaryOnlight
|
||||||
directionalIconDarkColorView.selectedColor = VDSColor.elementsPrimaryOndark
|
|
||||||
directionIconPickerSelectorView.text = Tilelet.DirectionalIcon.IconType.rightArrow.rawValue
|
directionIconPickerSelectorView.text = Tilelet.DirectionalIcon.IconType.rightArrow.rawValue
|
||||||
directionIconSizePickerSelectorView.text = Tilelet.DirectionalIcon.IconSize.medium.rawValue
|
directionIconSizePickerSelectorView.text = Tilelet.DirectionalIcon.IconSize.medium.rawValue
|
||||||
}
|
}
|
||||||
@ -537,12 +537,13 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
switch titleColorPickerSelectorView.selectedItem {
|
switch titleColorPickerSelectorView.selectedItem {
|
||||||
case .primary:
|
case .primary:
|
||||||
textColor = .primary
|
textColor = .primary
|
||||||
|
case .token:
|
||||||
|
textColor = .token(titleTokenColorView.selectedItem)
|
||||||
case .custom:
|
case .custom:
|
||||||
if let light = titleLightColorView.selectedColor {
|
if let color = titleCustomColorView.selectedColor {
|
||||||
let dark = titleDarkColorView.selectedColor ?? light
|
textColor = .custom(color)
|
||||||
textColor = .custom(light, dark)
|
|
||||||
} else {
|
} else {
|
||||||
textColor = .custom(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark)
|
textColor = .custom(VDSColor.elementsPrimaryOnlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -560,12 +561,13 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
textColor = .primary
|
textColor = .primary
|
||||||
case .secondary:
|
case .secondary:
|
||||||
textColor = .secondary
|
textColor = .secondary
|
||||||
|
case .token:
|
||||||
|
textColor = .token(subtitleTokenColorView.selectedItem)
|
||||||
case .custom:
|
case .custom:
|
||||||
if let light = subtitleLightColorView.selectedColor {
|
if let color = subtitleCustomColorView.selectedColor {
|
||||||
let dark = subtitleDarkColorView.selectedColor ?? light
|
textColor = .custom(color)
|
||||||
textColor = .custom(light, dark)
|
|
||||||
} else {
|
} else {
|
||||||
textColor = .custom(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark)
|
textColor = .custom(VDSColor.elementsPrimaryOnlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,15 +585,15 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
textColor = .primary
|
textColor = .primary
|
||||||
case .secondary:
|
case .secondary:
|
||||||
textColor = .secondary
|
textColor = .secondary
|
||||||
|
case .token:
|
||||||
|
textColor = .token(eyebrowTokenColorView.selectedItem)
|
||||||
case .custom:
|
case .custom:
|
||||||
if let light = eyebrowLightColorView.selectedColor {
|
if let color = eyebrowCustomColorView.selectedColor {
|
||||||
let dark = eyebrowDarkColorView.selectedColor ?? light
|
textColor = .custom(color)
|
||||||
textColor = .custom(light, dark)
|
|
||||||
} else {
|
} else {
|
||||||
textColor = .custom(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark)
|
textColor = .custom(VDSColor.elementsPrimaryOnlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component.eyebrowModel = Tilelet.EyebrowModel(text: text, textColor: textColor, isBold: eyebrowIsBold.isOn, standardStyle: otherStandardStylePickerSelectorView.selectedItem)
|
component.eyebrowModel = Tilelet.EyebrowModel(text: text, textColor: textColor, isBold: eyebrowIsBold.isOn, standardStyle: otherStandardStylePickerSelectorView.selectedItem)
|
||||||
} else {
|
} else {
|
||||||
component.eyebrowModel = nil
|
component.eyebrowModel = nil
|
||||||
@ -599,14 +601,14 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setDescriptiveIconModel() {
|
func setDescriptiveIconModel() {
|
||||||
let light = descriptionIconLightColorView.selectedColor ?? descriptionIconDarkColorView.selectedColor
|
let custom = descriptionIconCustomColorView.selectedColor ?? VDSColor.paletteBlack
|
||||||
let dark = descriptionIconDarkColorView.selectedColor ?? descriptionIconLightColorView.selectedColor
|
let token = descriptionIconTokenColorView.selectedItem
|
||||||
let iconSize = descriptionIconSizePickerSelectorView.selectedItem
|
let iconSize = descriptionIconSizePickerSelectorView.selectedItem
|
||||||
let iconName = descriptionNamePickerSelectorView.selectedItem
|
let iconName = descriptionNamePickerSelectorView.selectedItem
|
||||||
|
|
||||||
if let light, let dark {
|
if let iconColor {
|
||||||
component.descriptiveIconModel = .init(name: iconName,
|
component.descriptiveIconModel = .init(name: iconName,
|
||||||
colorConfiguration: SurfaceColorConfiguration(light, dark), size: iconSize)
|
iconColor: iconColor, size: iconSize)
|
||||||
} else {
|
} else {
|
||||||
component.descriptiveIconModel = .init(name: iconName,
|
component.descriptiveIconModel = .init(name: iconName,
|
||||||
size: iconSize)
|
size: iconSize)
|
||||||
@ -614,13 +616,13 @@ class TileletViewController: BaseViewController<Tilelet> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setDirectionalIconModel() {
|
func setDirectionalIconModel() {
|
||||||
let light = directionalIconLightColorView.selectedColor ?? directionalIconDarkColorView.selectedColor
|
let custom = directionalIconCustomColorView.selectedColor ?? VDSColor.paletteBlack
|
||||||
let dark = directionalIconDarkColorView.selectedColor ?? directionalIconLightColorView.selectedColor
|
let token = directionalIconTokenColorView.selectedItem
|
||||||
let iconType = directionIconPickerSelectorView.selectedItem
|
let iconType = directionIconPickerSelectorView.selectedItem
|
||||||
let iconSize = directionIconSizePickerSelectorView.selectedItem
|
let iconSize = directionIconSizePickerSelectorView.selectedItem
|
||||||
|
|
||||||
if let light, let dark {
|
if let iconColor {
|
||||||
component.directionalIconModel = .init(iconType: iconType, colorConfiguration: SurfaceColorConfiguration(light, dark), size: iconSize)
|
component.directionalIconModel = .init(iconType: iconType, iconColor: iconColor, size: iconSize)
|
||||||
} else {
|
} else {
|
||||||
component.directionalIconModel = .init(iconType: iconType, size: iconSize)
|
component.directionalIconModel = .init(iconType: iconType, size: iconSize)
|
||||||
}
|
}
|
||||||
@ -809,32 +811,22 @@ extension TileletViewController: UIColorPickerViewControllerDelegate {
|
|||||||
gradientColorView2.selectedColor = viewController.selectedColor
|
gradientColorView2.selectedColor = viewController.selectedColor
|
||||||
updateGradientColors()
|
updateGradientColors()
|
||||||
|
|
||||||
case .light, .dark:
|
case .custom:
|
||||||
var lightColorView: ColorPickerView<ColorPickerType>
|
var colorView: ColorPickerView<ColorPickerType>
|
||||||
var darkColorView: ColorPickerView<ColorPickerType>
|
|
||||||
|
|
||||||
switch currentSurfaceColorType {
|
switch currentSurfaceColorType {
|
||||||
case .eyebrow:
|
case .eyebrow:
|
||||||
lightColorView = eyebrowLightColorView
|
colorView = eyebrowCustomColorView
|
||||||
darkColorView = eyebrowDarkColorView
|
|
||||||
case .title:
|
case .title:
|
||||||
lightColorView = titleLightColorView
|
colorView = titleCustomColorView
|
||||||
darkColorView = titleDarkColorView
|
|
||||||
case .subtitle:
|
case .subtitle:
|
||||||
lightColorView = subtitleLightColorView
|
colorView = subtitleCustomColorView
|
||||||
darkColorView = subtitleDarkColorView
|
|
||||||
case .directionalIcon:
|
case .directionalIcon:
|
||||||
lightColorView = directionalIconLightColorView
|
colorView = directionalIconCustomColorView
|
||||||
darkColorView = directionalIconDarkColorView
|
|
||||||
case .descriptionIcon:
|
case .descriptionIcon:
|
||||||
lightColorView = descriptionIconLightColorView
|
colorView = descriptionIconCustomColorView
|
||||||
darkColorView = descriptionIconDarkColorView
|
|
||||||
}
|
|
||||||
if colorPickerType == .light {
|
|
||||||
lightColorView.selectedColor = viewController.selectedColor
|
|
||||||
} else {
|
|
||||||
darkColorView.selectedColor = viewController.selectedColor
|
|
||||||
}
|
}
|
||||||
|
colorView.selectedColor = viewController.selectedColor
|
||||||
|
|
||||||
switch currentSurfaceColorType {
|
switch currentSurfaceColorType {
|
||||||
case .eyebrow:
|
case .eyebrow:
|
||||||
|
|||||||
@ -45,22 +45,22 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
var currentLabelType: LabelType = .title
|
var currentLabelType: LabelType = .title
|
||||||
var colorPickerType: ColorPickerType = .light
|
var colorPickerType: ColorPickerType = .custom
|
||||||
|
|
||||||
enum LabelType {
|
enum LabelType {
|
||||||
case eyebrow, title, subtitle
|
case eyebrow, title, subtitle
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TitleTextColor: String, CaseIterable {
|
enum TitleTextColor: String, CaseIterable {
|
||||||
case primary, custom
|
case primary, token, custom
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TextColor: String, CaseIterable {
|
enum TextColor: String, CaseIterable {
|
||||||
case primary, secondary, custom
|
case primary, secondary, token, custom
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ColorPickerType {
|
enum ColorPickerType {
|
||||||
case light, dark
|
case custom
|
||||||
}
|
}
|
||||||
|
|
||||||
/// eyebrow
|
/// eyebrow
|
||||||
@ -71,15 +71,14 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
items: TextColor.allCases)
|
items: TextColor.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var eyebrowLightColorView: ColorPickerView<ColorPickerType> = {
|
lazy var eyebrowTokenColorView = {
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
self?.colorPickerType = picker.pickerType
|
picker: self.picker,
|
||||||
self?.selectedColorTapped(picker)
|
items: UIColor.VDSColor.allCases)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var eyebrowDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var eyebrowCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
@ -92,15 +91,15 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
items: TitleTextColor.allCases)
|
items: TitleTextColor.allCases)
|
||||||
}()
|
}()
|
||||||
lazy var titleLightColorView: ColorPickerView<ColorPickerType> = {
|
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
|
||||||
self?.colorPickerType = picker.pickerType
|
|
||||||
self?.selectedColorTapped(picker)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
lazy var titleDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var titleTokenColorView = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
|
picker: self.picker,
|
||||||
|
items: UIColor.VDSColor.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
|
lazy var titleCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
@ -113,15 +112,15 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
items: TextColor.allCases)
|
items: TextColor.allCases)
|
||||||
}()
|
}()
|
||||||
lazy var subtitleLightColorView: ColorPickerView<ColorPickerType> = {
|
|
||||||
return .init(with: ColorPickerType.light) { [weak self] picker in
|
|
||||||
self?.colorPickerType = picker.pickerType
|
|
||||||
self?.selectedColorTapped(picker)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
lazy var subtitleDarkColorView: ColorPickerView<ColorPickerType> = {
|
lazy var subtitleTokenColorView = {
|
||||||
return .init(with: ColorPickerType.dark) { [weak self] picker in
|
PickerSelectorView(title: "paletteBlack",
|
||||||
|
picker: self.picker,
|
||||||
|
items: UIColor.VDSColor.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
|
lazy var subtitleCustomColorView: ColorPickerView<ColorPickerType> = {
|
||||||
|
return .init(with: ColorPickerType.custom) { [weak self] picker in
|
||||||
self?.colorPickerType = picker.pickerType
|
self?.colorPickerType = picker.pickerType
|
||||||
self?.selectedColorTapped(picker)
|
self?.selectedColorTapped(picker)
|
||||||
}
|
}
|
||||||
@ -145,22 +144,22 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
addFormRow(label: "Eyebrow is Bold", view: eyebrowIsBold)
|
addFormRow(label: "Eyebrow is Bold", view: eyebrowIsBold)
|
||||||
addFormRow(label: "Eyebrow Text", view: eyebrowTextField)
|
addFormRow(label: "Eyebrow Text", view: eyebrowTextField)
|
||||||
addFormRow(label: "Eyebrow Color", view: eyebrowColorPickerSelectorView)
|
addFormRow(label: "Eyebrow Color", view: eyebrowColorPickerSelectorView)
|
||||||
eyebrowColorsFormStackView.addFormRow(label: "Light", view: eyebrowLightColorView)
|
eyebrowColorsFormStackView.addFormRow(label: "Token", view: eyebrowTokenColorView)
|
||||||
eyebrowColorsFormStackView.addFormRow(label: "Dark", view: eyebrowDarkColorView)
|
eyebrowColorsFormStackView.addFormRow(label: "Custom", view: eyebrowCustomColorView)
|
||||||
append(section: eyebrowColorsFormStackView)
|
append(section: eyebrowColorsFormStackView)
|
||||||
|
|
||||||
addFormRow(label: "Title is Bold", view: titleIsBold)
|
addFormRow(label: "Title is Bold", view: titleIsBold)
|
||||||
addFormRow(label: "Title Style", view: titleStandardStylePickerSelectorView)
|
addFormRow(label: "Title Style", view: titleStandardStylePickerSelectorView)
|
||||||
addFormRow(label: "Title Text", view: titleTextField)
|
addFormRow(label: "Title Text", view: titleTextField)
|
||||||
addFormRow(label: "Title Color", view: titleColorPickerSelectorView)
|
addFormRow(label: "Title Color", view: titleColorPickerSelectorView)
|
||||||
titleColorsFormStackView.addFormRow(label: "Light", view: titleLightColorView)
|
titleColorsFormStackView.addFormRow(label: "Token", view: titleTokenColorView)
|
||||||
titleColorsFormStackView.addFormRow(label: "Dark", view: titleDarkColorView)
|
titleColorsFormStackView.addFormRow(label: "Dark", view: titleCustomColorView)
|
||||||
append(section: titleColorsFormStackView)
|
append(section: titleColorsFormStackView)
|
||||||
|
|
||||||
addFormRow(label: "Subtitle Text", view: subTitleTextField)
|
addFormRow(label: "Subtitle Text", view: subTitleTextField)
|
||||||
addFormRow(label: "Subtitle Color", view: subtitleColorPickerSelectorView)
|
addFormRow(label: "Subtitle Color", view: subtitleColorPickerSelectorView)
|
||||||
subtitleColorsFormStackView.addFormRow(label: "Light", view: subtitleLightColorView)
|
subtitleColorsFormStackView.addFormRow(label: "Token", view: subtitleTokenColorView)
|
||||||
subtitleColorsFormStackView.addFormRow(label: "Dark", view: subtitleDarkColorView)
|
subtitleColorsFormStackView.addFormRow(label: "Custom", view: subtitleCustomColorView)
|
||||||
append(section: subtitleColorsFormStackView)
|
append(section: subtitleColorsFormStackView)
|
||||||
|
|
||||||
|
|
||||||
@ -221,12 +220,13 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
switch titleColorPickerSelectorView.selectedItem {
|
switch titleColorPickerSelectorView.selectedItem {
|
||||||
case .primary:
|
case .primary:
|
||||||
textColor = .primary
|
textColor = .primary
|
||||||
|
case .token:
|
||||||
|
textColor = .token(titleTokenColorView.selectedItem)
|
||||||
case .custom:
|
case .custom:
|
||||||
if let light = titleLightColorView.selectedColor {
|
if let color = titleCustomColorView.selectedColor {
|
||||||
let dark = titleDarkColorView.selectedColor ?? light
|
textColor = .custom(color)
|
||||||
textColor = .custom(light, dark)
|
|
||||||
} else {
|
} else {
|
||||||
textColor = .custom(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark)
|
textColor = .custom(VDSColor.elementsPrimaryOnlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,12 +255,13 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
textColor = .primary
|
textColor = .primary
|
||||||
case .secondary:
|
case .secondary:
|
||||||
textColor = .secondary
|
textColor = .secondary
|
||||||
|
case .token:
|
||||||
|
textColor = .token(subtitleTokenColorView.selectedItem)
|
||||||
case .custom:
|
case .custom:
|
||||||
if let light = subtitleLightColorView.selectedColor {
|
if let color = subtitleCustomColorView.selectedColor {
|
||||||
let dark = subtitleDarkColorView.selectedColor ?? light
|
textColor = .custom(color)
|
||||||
textColor = .custom(light, dark)
|
|
||||||
} else {
|
} else {
|
||||||
textColor = .custom(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark)
|
textColor = .custom(VDSColor.elementsPrimaryOnlight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
component.subTitleModel = TitleLockup.SubTitleModel(text: text, otherStandardStyle: style, textColor: textColor)
|
component.subTitleModel = TitleLockup.SubTitleModel(text: text, otherStandardStyle: style, textColor: textColor)
|
||||||
@ -276,13 +277,15 @@ class TitleLockupViewController: BaseViewController<TitleLockup> {
|
|||||||
textColor = .primary
|
textColor = .primary
|
||||||
case .secondary:
|
case .secondary:
|
||||||
textColor = .secondary
|
textColor = .secondary
|
||||||
|
case .token:
|
||||||
|
textColor = .token(eyebrowTokenColorView.selectedItem)
|
||||||
case .custom:
|
case .custom:
|
||||||
if let light = eyebrowLightColorView.selectedColor {
|
if let color = eyebrowCustomColorView.selectedColor {
|
||||||
let dark = eyebrowDarkColorView.selectedColor ?? light
|
textColor = .custom(color)
|
||||||
textColor = .custom(light, dark)
|
|
||||||
} else {
|
} else {
|
||||||
textColor = .custom(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark)
|
textColor = .custom(VDSColor.elementsPrimaryOnlight)
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
component.eyebrowModel = TitleLockup.EyebrowModel(text: text, textColor: textColor, isBold: eyebrowIsBold.isOn, standardStyle: style)
|
component.eyebrowModel = TitleLockup.EyebrowModel(text: text, textColor: textColor, isBold: eyebrowIsBold.isOn, standardStyle: style)
|
||||||
debug(type: "EyeBrow", textStyle: eyebrowIsBold.isOn ? style.value.bold : style.value.regular)
|
debug(type: "EyeBrow", textStyle: eyebrowIsBold.isOn ? style.value.bold : style.value.regular)
|
||||||
|
|
||||||
@ -373,26 +376,18 @@ extension TitleLockupViewController: UIColorPickerViewControllerDelegate {
|
|||||||
|
|
||||||
func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) {
|
func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) {
|
||||||
guard let hexString = viewController.selectedColor.hexString else { return }
|
guard let hexString = viewController.selectedColor.hexString else { return }
|
||||||
var lightColorView: ColorPickerView<ColorPickerType>
|
var colorView: ColorPickerView<ColorPickerType>
|
||||||
var darkColorView: ColorPickerView<ColorPickerType>
|
|
||||||
|
|
||||||
switch currentLabelType {
|
switch currentLabelType {
|
||||||
case .eyebrow:
|
case .eyebrow:
|
||||||
lightColorView = eyebrowLightColorView
|
colorView = eyebrowCustomColorView
|
||||||
darkColorView = eyebrowDarkColorView
|
|
||||||
case .title:
|
case .title:
|
||||||
lightColorView = titleLightColorView
|
colorView = titleCustomColorView
|
||||||
darkColorView = titleDarkColorView
|
|
||||||
case .subtitle:
|
case .subtitle:
|
||||||
lightColorView = subtitleLightColorView
|
colorView = subtitleCustomColorView
|
||||||
darkColorView = subtitleDarkColorView
|
|
||||||
}
|
|
||||||
switch colorPickerType {
|
|
||||||
case .light:
|
|
||||||
lightColorView.selectedColor = viewController.selectedColor
|
|
||||||
case .dark:
|
|
||||||
darkColorView.selectedColor = viewController.selectedColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
colorView.selectedColor = viewController.selectedColor
|
||||||
|
|
||||||
if currentLabelType == .title {
|
if currentLabelType == .title {
|
||||||
setTitleModel()
|
setTitleModel()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user