notification background color changes

This commit is contained in:
Sumanth Nadigadda 2023-03-16 23:38:55 +05:30
parent e9b05fcda1
commit fd512cc38c

View File

@ -86,12 +86,12 @@ public class Notification: View {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Configuration // MARK: - Configuration
//-------------------------------------------------- //--------------------------------------------------
private var backgroundColorConfiguration: StateColorConfiguration<NotificationStyle> = { private var backgroundColorConfiguration: KeyedColorConfiguration<NotificationStyle, Notification> = {
let config = StateColorConfiguration<NotificationStyle>() let config = KeyedColorConfiguration<NotificationStyle, Notification>(keyName: "type")
config.setSurfaceColors(VDSColor.feedbackInformationBackgroundOnlight, VDSColor.feedbackInformationBackgroundOndark, forState: .info) config.setSurfaceColors(VDSColor.feedbackInformationBackgroundOnlight, VDSColor.feedbackInformationBackgroundOndark, forKey: .info)
config.setSurfaceColors(VDSColor.feedbackWarningBackgroundOnlight, VDSColor.feedbackWarningBackgroundOndark, forState: .warning) config.setSurfaceColors(VDSColor.feedbackWarningBackgroundOnlight, VDSColor.feedbackWarningBackgroundOndark, forKey: .warning)
config.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success) config.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forKey: .success)
config.setSurfaceColors(VDSColor.feedbackErrorBackgroundOnlight, VDSColor.feedbackErrorBackgroundOndark, forState: .error) config.setSurfaceColors(VDSColor.feedbackErrorBackgroundOnlight, VDSColor.feedbackErrorBackgroundOndark, forKey: .error)
return config return config
}() }()
@ -145,6 +145,10 @@ public class Notification: View {
open override func reset() { open override func reset() {
super.reset() super.reset()
type = .info
typeIcon.name = .infoBold
closeButton.name = .close
} }
//-------------------------------------------------- //--------------------------------------------------
@ -153,7 +157,7 @@ public class Notification: View {
open override func updateView() { open override func updateView() {
updateTextColorConfig() updateTextColorConfig()
backgroundColor = backgroundColorConfiguration.getColor(surface, forState: type) backgroundColor = backgroundColorConfiguration.getColor(self)
typeIcon.name = type.styleIconName() typeIcon.name = type.styleIconName()
typeIcon.color = surface == .dark ? Icon.Color.white : Icon.Color.black typeIcon.color = surface == .dark ? Icon.Color.white : Icon.Color.black
closeButton.color = surface == .dark ? Icon.Color.white : Icon.Color.black closeButton.color = surface == .dark ? Icon.Color.white : Icon.Color.black