diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 40c1139b..c9cceca8 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -11,15 +11,19 @@ import VDSColorTokens import VDSFormControlsTokens import Combine -public enum BadgeFillColor: String, Codable, CaseIterable { - case red, yellow, green, orange, blue, black, white -} - - /// Badges are visual labels used to convey status or highlight supplemental information. @objc(VDSBadge) public class Badge: View, Accessable { + //-------------------------------------------------- + // MARK: - Enums + //-------------------------------------------------- + public enum FillColor: String, Codable, CaseIterable { + case red, yellow, green, orange, blue, black, white + } + //-------------------------------------------------- + // MARK: - Private Properties + //-------------------------------------------------- private var label = Label().with { $0.setContentCompressionResistancePriority(.required, for: .vertical) $0.adjustsFontSizeToFitWidth = false @@ -31,7 +35,7 @@ public class Badge: View, Accessable { //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- - open var fillColor: BadgeFillColor = .red { didSet { didChange() }} + open var fillColor: FillColor = .red { didSet { didChange() }} open var text: String = "" { didSet { didChange() }} @@ -102,8 +106,8 @@ public class Badge: View, Accessable { //-------------------------------------------------- // MARK: - Configuration //-------------------------------------------------- - private var backgroundColorConfig: StateColorConfiguration = { - let config = StateColorConfiguration() + 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) diff --git a/VDS/Components/Tilet/TiletBadgeModel.swift b/VDS/Components/Tilet/TiletBadgeModel.swift index 88ffc82b..2ea327e5 100644 --- a/VDS/Components/Tilet/TiletBadgeModel.swift +++ b/VDS/Components/Tilet/TiletBadgeModel.swift @@ -9,11 +9,11 @@ import Foundation public struct TiletBadgeModel: Codable { public var text: String = "" - public var fillColor: BadgeFillColor + public var fillColor:Badge.FillColor public var surface: Surface public var numberOfLines: Int public var maxWidth: CGFloat? - public init(text: String, fillColor: BadgeFillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) { + public init(text: String, fillColor: Badge.FillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) { self.text = text self.fillColor = fillColor self.surface = surface