From 568ab2e5e57f44d472c4619f222eee5efc1f457e Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 2 Jul 2024 10:56:40 -0500 Subject: [PATCH] added surface Signed-off-by: Matt Bruce --- MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift | 2 ++ MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift index 3a1722e0..e21f9895 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift @@ -39,6 +39,8 @@ import VDS // MARK: - Atomic //-------------------------------------------------- public func viewModelDidUpdate() { + surface = viewModel.surface + updateCheckbox() //primary label diff --git a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift index 31cdf46d..1592bd02 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift @@ -8,6 +8,7 @@ import Foundation import MVMCore +import VDS public enum CheckboxPosition: String, Codable { case center @@ -24,6 +25,8 @@ public enum CheckboxPosition: String, Codable { public var checkbox: CheckboxModel public var label: LabelModel public var subtitle: LabelModel? + public var inverted: Bool = false + public var surface: Surface { inverted ? .dark : .light } public var children: [MoleculeModelProtocol] { guard let subtitle else { return [checkbox, label] } @@ -34,9 +37,10 @@ public enum CheckboxPosition: String, Codable { // MARK: - Initializer //-------------------------------------------------- - public init(checkbox: CheckboxModel, label: LabelModel) { + public init(checkbox: CheckboxModel, label: LabelModel, subtitle: LabelModel?) { self.checkbox = checkbox self.label = label + self.subtitle = subtitle } }