added Notification Type

This commit is contained in:
Krishna Kishore Bandaru 2024-02-13 22:36:50 +05:30
parent 3dc55db8ea
commit 3b3d7eff60

View File

@ -58,6 +58,11 @@ open class Notification: View {
case vertical, horizontal case vertical, horizontal
} }
/// Enum used to describe the type of the Notification.
public enum `Type`: String, CaseIterable {
case fullBleed, inLine
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Private Properties // MARK: - Private Properties
//-------------------------------------------------- //--------------------------------------------------
@ -69,7 +74,7 @@ open class Notification: View {
} }
private var labelsView = UIStackView().with { private var labelsView = UIStackView().with {
$0.spacing = 1.0 $0.spacing = VDSLayout.Spacing.space1X.value
$0.translatesAutoresizingMaskIntoConstraints = false $0.translatesAutoresizingMaskIntoConstraints = false
$0.alignment = .fill $0.alignment = .fill
$0.distribution = .equalSpacing $0.distribution = .equalSpacing
@ -173,7 +178,10 @@ open class Notification: View {
/// Add this attribute determine your type of Notification. /// Add this attribute determine your type of Notification.
open var style: Style = .info { didSet { setNeedsUpdate()}} 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. /// Determines the orientation of buttons and text in the Notification.
open var layout: Layout { open var layout: Layout {
@ -323,6 +331,7 @@ open class Notification: View {
open override func updateView() { open override func updateView() {
super.updateView() super.updateView()
layer.cornerRadius = type == .fullBleed ? 0 : 4.0
backgroundColor = backgroundColorConfiguration.getColor(self) backgroundColor = backgroundColorConfiguration.getColor(self)
updateIcons() updateIcons()
updateLabels() updateLabels()