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