using new color configuration classes

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-03-16 11:33:10 -05:00
parent 4405e3ffc1
commit 66c769ba52

View File

@ -81,15 +81,15 @@ public class Badge: View {
//--------------------------------------------------
// MARK: - Configuration
//--------------------------------------------------
private var backgroundColorConfig: StateColorConfiguration<FillColor> = {
let config = StateColorConfiguration<FillColor>()
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<FillColor, Badge> = {
let config = KeyedColorConfiguration<FillColor, Badge>(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 {
}
}
}