From 66c769ba52fc1d4bb76214394c8468d7fb0f1653 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 16 Mar 2023 11:33:10 -0500 Subject: [PATCH] using new color configuration classes Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 8a0bc7b5..10a0ed59 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -81,15 +81,15 @@ public class Badge: View { //-------------------------------------------------- // MARK: - Configuration //-------------------------------------------------- - private var backgroundColorConfig: StateColorConfiguration = { - let config = StateColorConfiguration() - config.setSurfaceColors(VDSColor.backgroundBrandhighlight, VDSColor.backgroundBrandhighlight, forState: .red) - config.setSurfaceColors(VDSColor.paletteYellow62, VDSColor.paletteYellow62, forState: .yellow) - config.setSurfaceColors(VDSColor.paletteGreen26, VDSColor.paletteGreen34, forState: .green) - config.setSurfaceColors(VDSColor.paletteOrange39, VDSColor.paletteOrange46, forState: .orange) - config.setSurfaceColors(VDSColor.paletteBlue35, VDSColor.paletteBlue45, forState: .blue) - config.setSurfaceColors(VDSColor.paletteBlack, VDSColor.paletteBlack, forState: .black) - config.setSurfaceColors(VDSColor.paletteWhite, VDSColor.paletteWhite, forState: .white) + private var backgroundColorConfig: KeyedColorConfiguration = { + let config = KeyedColorConfiguration(keyName: "fillColor") + config.setSurfaceColors(VDSColor.backgroundBrandhighlight, VDSColor.backgroundBrandhighlight, forKey: .red) + config.setSurfaceColors(VDSColor.paletteYellow62, VDSColor.paletteYellow62, forKey: .yellow) + config.setSurfaceColors(VDSColor.paletteGreen26, VDSColor.paletteGreen34, forKey: .green) + config.setSurfaceColors(VDSColor.paletteOrange39, VDSColor.paletteOrange46, forKey: .orange) + config.setSurfaceColors(VDSColor.paletteBlue35, VDSColor.paletteBlue45, forKey: .blue) + config.setSurfaceColors(VDSColor.paletteBlack, VDSColor.paletteBlack, forKey: .black) + config.setSurfaceColors(VDSColor.paletteWhite, VDSColor.paletteWhite, forKey: .white) return config }() @@ -120,7 +120,7 @@ public class Badge: View { open override func updateView() { updateTextColorConfig() - backgroundColor = backgroundColorConfig.getColor(surface, forState: fillColor) + backgroundColor = backgroundColorConfig.getColor(self) label.textColorConfiguration = textColorConfig.eraseToAnyColorable() label.numberOfLines = numberOfLines @@ -136,4 +136,3 @@ public class Badge: View { } } } -