From 3b3d7eff600a3fdac7df72b70e49c2e632700259 Mon Sep 17 00:00:00 2001 From: Krishna Kishore Bandaru Date: Tue, 13 Feb 2024 22:36:50 +0530 Subject: [PATCH] added Notification Type --- VDS/Components/Notification/Notification.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index 5caebaa7..6e63a8aa 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -58,6 +58,11 @@ open class Notification: View { case vertical, horizontal } + /// Enum used to describe the type of the Notification. + public enum `Type`: String, CaseIterable { + case fullBleed, inLine + } + //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- @@ -69,7 +74,7 @@ open class Notification: View { } private var labelsView = UIStackView().with { - $0.spacing = 1.0 + $0.spacing = VDSLayout.Spacing.space1X.value $0.translatesAutoresizingMaskIntoConstraints = false $0.alignment = .fill $0.distribution = .equalSpacing @@ -173,7 +178,10 @@ open class Notification: View { /// Add this attribute determine your type of Notification. open var style: Style = .info { didSet { setNeedsUpdate()}} - var _layout: Layout = .vertical + /// If true, will hide the close button. + open var type: Type = .inLine { didSet { setNeedsUpdate()} } + + private var _layout: Layout = .vertical /// Determines the orientation of buttons and text in the Notification. open var layout: Layout { @@ -323,6 +331,7 @@ open class Notification: View { open override func updateView() { super.updateView() + layer.cornerRadius = type == .fullBleed ? 0 : 4.0 backgroundColor = backgroundColorConfiguration.getColor(self) updateIcons() updateLabels()