updated checkbox

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-08-03 13:33:01 -05:00
parent 2b103724e3
commit da517ee9f8
2 changed files with 26 additions and 18 deletions

View File

@ -280,10 +280,18 @@ open class VDSCheckboxBase<ModelType: VDSCheckboxModel>: VDSControl<ModelType>,
colors = (on: VDSColor.interactiveDisabledOndark, off: .clear)
}
} else {
if viewModel.surface == .light {
colors = (on: VDSColor.elementsPrimaryOnlight, off: .clear)
if viewModel.showError {
if viewModel.surface == .light {
colors = (on: VDSColor.elementsPrimaryOnlight, off: VDSColor.feedbackErrorBackgroundOnlight)
} else {
colors = (on: VDSColor.elementsPrimaryOndark, off: VDSColor.feedbackErrorBackgroundOndark)
}
} else {
colors = (on: VDSColor.elementsPrimaryOndark, off: .clear)
if viewModel.surface == .light {
colors = (on: VDSColor.elementsPrimaryOnlight, off: .clear)
} else {
colors = (on: VDSColor.elementsPrimaryOndark, off: .clear)
}
}
}
return viewModel.on ? colors.on : colors.off
@ -298,10 +306,18 @@ open class VDSCheckboxBase<ModelType: VDSCheckboxModel>: VDSControl<ModelType>,
colors = (on: VDSColor.interactiveDisabledOndark, off: VDSColor.interactiveDisabledOnlight)
}
} else {
if viewModel.surface == .light {
colors = (on: VDSColor.elementsPrimaryOnlight, off: VDSFormControlsColor.borderOnlight)
if viewModel.showError {
if viewModel.surface == .light {
colors = (on: VDSColor.elementsPrimaryOnlight, off: VDSColor.feedbackErrorOnlight)
} else {
colors = (on: VDSColor.elementsPrimaryOndark, off: VDSColor.feedbackErrorOndark)
}
} else {
colors = (on: VDSColor.elementsPrimaryOndark, off: VDSFormControlsColor.borderOndark)
if viewModel.surface == .light {
colors = (on: VDSColor.elementsPrimaryOnlight, off: VDSFormControlsColor.borderOnlight)
} else {
colors = (on: VDSColor.elementsPrimaryOndark, off: VDSFormControlsColor.borderOndark)
}
}
}
return viewModel.on ? colors.on : colors.off
@ -309,18 +325,10 @@ open class VDSCheckboxBase<ModelType: VDSCheckboxModel>: VDSControl<ModelType>,
private func getCheckboxCheckColor(_ viewModel: ModelType) -> UIColor {
var color: UIColor
if disabled {
if surface == .light {
color = VDSColor.interactiveDisabledOndark
} else {
color = VDSColor.interactiveDisabledOnlight
}
if surface == .light {
color = VDSColor.elementsPrimaryOndark
} else {
if surface == .light {
color = VDSColor.elementsPrimaryOndark
} else {
color = VDSColor.elementsPrimaryOnlight
}
color = VDSColor.elementsPrimaryOnlight
}
return viewModel.on ? color : .clear
}

View File

@ -27,7 +27,7 @@ extension VDSCheckboxModel {
}
public var shouldShowError: Bool {
guard showError && errorText?.isEmpty == false else { return false }
guard showError && !disabled && errorText?.isEmpty == false else { return false }
return true
}