refactored more color
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
702687ee2c
commit
1d182f44ef
@ -37,13 +37,17 @@ class BadgeIndicatorViewController: BaseViewController<BadgeIndicator> {
|
|||||||
items: BadgeIndicator.MaximumDigits.allCases)
|
items: BadgeIndicator.MaximumDigits.allCases)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
enum BackgroundColor: String, CaseIterable {
|
enum BorderColor: String, CaseIterable {
|
||||||
case token, custom
|
case `default`, token, custom
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy var borderColorLightPickerSelectorView: TokenColorPickerSection = {
|
lazy var borderColorLightPickerSelectorView: TokenColorPickerSection = {
|
||||||
TokenColorPickerSection<BackgroundColor>(rowTitle: "Border Light",
|
TokenColorPickerSection<BorderColor>(rowTitle: "Border Light",
|
||||||
picker: self.picker).with {
|
picker: self.picker).with {
|
||||||
|
$0.onSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
component.borderColorLight = nil
|
||||||
|
}
|
||||||
$0.onTokenSelected = { [weak self] color in
|
$0.onTokenSelected = { [weak self] color in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
component.borderColorLight = color.uiColor
|
component.borderColorLight = color.uiColor
|
||||||
@ -56,8 +60,12 @@ class BadgeIndicatorViewController: BaseViewController<BadgeIndicator> {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var borderColorDarkPickerSelectorView : TokenColorPickerSection = {
|
lazy var borderColorDarkPickerSelectorView : TokenColorPickerSection = {
|
||||||
TokenColorPickerSection<BackgroundColor>(rowTitle: "Border Dark",
|
TokenColorPickerSection<BorderColor>(rowTitle: "Border Dark",
|
||||||
picker: self.picker).with {
|
picker: self.picker).with {
|
||||||
|
$0.onSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
component.borderColorDark = nil
|
||||||
|
}
|
||||||
$0.onTokenSelected = { [weak self] color in
|
$0.onTokenSelected = { [weak self] color in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
component.borderColorDark = color.uiColor
|
component.borderColorDark = color.uiColor
|
||||||
|
|||||||
@ -12,19 +12,52 @@ import VDSCoreTokens
|
|||||||
import Combine
|
import Combine
|
||||||
|
|
||||||
class IconViewController: BaseViewController<Icon> {
|
class IconViewController: BaseViewController<Icon> {
|
||||||
|
enum IconColor: String, CaseIterable {
|
||||||
|
case `default`, token, custom
|
||||||
|
}
|
||||||
|
|
||||||
lazy var lightColorPickerSelectorView = {
|
lazy var lightColorPickerSelectorView : TokenColorPickerSection = {
|
||||||
PickerSelectorView(title: "",
|
TokenColorPickerSection<IconColor>(rowTitle: "Light Color",
|
||||||
picker: self.picker,
|
picker: self.picker).with {
|
||||||
items: UIColor.VDSColor.allCases)
|
$0.onSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
light = .black
|
||||||
|
setColorConfiguration()
|
||||||
|
}
|
||||||
|
$0.onTokenSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
light = color.uiColor
|
||||||
|
setColorConfiguration()
|
||||||
|
}
|
||||||
|
$0.onColorSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
light = color
|
||||||
|
setColorConfiguration()
|
||||||
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var darkColorPickerSelectorView = {
|
lazy var darkColorPickerSelectorView: TokenColorPickerSection = {
|
||||||
PickerSelectorView(title: "",
|
TokenColorPickerSection<IconColor>(rowTitle: "Dark Color",
|
||||||
picker: self.picker,
|
picker: self.picker).with {
|
||||||
items: UIColor.VDSColor.allCases)
|
$0.onSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
dark = .white
|
||||||
|
setColorConfiguration()
|
||||||
|
}
|
||||||
|
$0.onTokenSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
dark = color.uiColor
|
||||||
|
setColorConfiguration()
|
||||||
|
}
|
||||||
|
$0.onColorSelected = { [weak self] color in
|
||||||
|
guard let self else { return }
|
||||||
|
dark = color
|
||||||
|
setColorConfiguration()
|
||||||
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
lazy var namePickerSelectorView = {
|
lazy var namePickerSelectorView = {
|
||||||
PickerSelectorView(title: "",
|
PickerSelectorView(title: "",
|
||||||
picker: self.picker,
|
picker: self.picker,
|
||||||
@ -51,8 +84,8 @@ class IconViewController: BaseViewController<Icon> {
|
|||||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||||
addFormRow(label: "Size", view: sizePickerSelectorView)
|
addFormRow(label: "Size", view: sizePickerSelectorView)
|
||||||
addFormRow(label: "Custom Size", view: customSizeField)
|
addFormRow(label: "Custom Size", view: customSizeField)
|
||||||
addFormRow(label: "Light Color", view: lightColorPickerSelectorView)
|
append(section: lightColorPickerSelectorView)
|
||||||
addFormRow(label: "Dark Color", view: darkColorPickerSelectorView)
|
append(section: darkColorPickerSelectorView)
|
||||||
addFormRow(label: "Name", view: namePickerSelectorView)
|
addFormRow(label: "Name", view: namePickerSelectorView)
|
||||||
|
|
||||||
customSizeField
|
customSizeField
|
||||||
@ -69,8 +102,6 @@ class IconViewController: BaseViewController<Icon> {
|
|||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
sizePickerSelectorView.text = component.size.rawValue
|
sizePickerSelectorView.text = component.size.rawValue
|
||||||
lightColorPickerSelectorView.text = UIColor.VDSColor.elementsPrimaryOnlight.rawValue
|
|
||||||
darkColorPickerSelectorView.text = UIColor.VDSColor.elementsPrimaryOndark.rawValue
|
|
||||||
namePickerSelectorView.text = name.rawValue
|
namePickerSelectorView.text = name.rawValue
|
||||||
}
|
}
|
||||||
func setupPicker(){
|
func setupPicker(){
|
||||||
@ -83,23 +114,15 @@ class IconViewController: BaseViewController<Icon> {
|
|||||||
sizePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
sizePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
self?.component.size = item
|
self?.component.size = item
|
||||||
}
|
}
|
||||||
|
|
||||||
lightColorPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
|
||||||
self?.setColorConfiguration()
|
|
||||||
}
|
|
||||||
|
|
||||||
darkColorPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
|
||||||
self?.setColorConfiguration()
|
|
||||||
}
|
|
||||||
|
|
||||||
namePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
namePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
self?.component.name = item
|
self?.component.name = item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var light: UIColor = .black
|
||||||
|
var dark: UIColor = .white
|
||||||
func setColorConfiguration() {
|
func setColorConfiguration() {
|
||||||
let light = lightColorPickerSelectorView.selectedItem.uiColor
|
|
||||||
let dark = darkColorPickerSelectorView.selectedItem.uiColor
|
|
||||||
component.colorConfiguration = .init(light, dark)
|
component.colorConfiguration = .init(light, dark)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user