diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index 47785d6b..9cdba0fb 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -18,7 +18,7 @@ public class Notification: View { // MARK: - Enums //-------------------------------------------------- - public enum NotificationStyle: String, CaseIterable { + public enum Style: String, CaseIterable { case info, success, warning, error func styleIconName() -> Icon.Name { @@ -136,7 +136,9 @@ public class Notification: View { // MARK: - Properties //-------------------------------------------------- - open var type: NotificationStyle = .info { didSet{didChange()}} + open var hideCloseButton: Bool = false { didSet{didChange()}} + + open var type: Style = .info { didSet{didChange()}} var _layout: Layout = .vertical open var layout: Layout { @@ -153,7 +155,7 @@ public class Notification: View { // MARK: - Configuration //-------------------------------------------------- private var backgroundColorConfiguration: AnyColorable = { - let config = KeyedColorConfiguration(keyPath: \.type) + let config = KeyedColorConfiguration(keyPath: \.type) config.setSurfaceColors(VDSColor.feedbackInformationBackgroundOnlight, VDSColor.feedbackInformationBackgroundOndark, forKey: .info) config.setSurfaceColors(VDSColor.feedbackWarningBackgroundOnlight, VDSColor.feedbackWarningBackgroundOndark, forKey: .warning) config.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forKey: .success) @@ -219,6 +221,7 @@ public class Notification: View { typeIcon.name = .infoBold closeButton.name = .close layout = .vertical + hideCloseButton = false } //-------------------------------------------------- @@ -236,6 +239,7 @@ public class Notification: View { typeIcon.name = type.styleIconName() typeIcon.color = iconColor closeButton.color = iconColor + closeButton.isHidden = hideCloseButton } private func updateLabels() {