From 960cf33b4193e3765c218bea71c52550e039bdfd Mon Sep 17 00:00:00 2001 From: vasavk Date: Fri, 9 Feb 2024 16:45:50 +0530 Subject: [PATCH] story:ONEAPP-6315: made changes for selectedIconName, and selected state of buttonIcon --- VDS/Components/Icon/ButtonIcon/ButtonIcon.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift index 5b09a13d..5e1e792e 100644 --- a/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift +++ b/VDS/Components/Icon/ButtonIcon/ButtonIcon.swift @@ -75,7 +75,7 @@ open class ButtonIcon: Control { private var badgeIndicatorLeadingConstraint: NSLayoutConstraint? private var badgeIndicatorBottomConstraint: NSLayoutConstraint? private var currentIconName: Icon.Name? { - if let selectedIconName { + if let selectedIconName, selectable { return selectedIconName } else { return iconName @@ -120,7 +120,7 @@ open class ButtonIcon: Control { /// Icon Name used within the Icon. open var iconName: Icon.Name? { didSet { setNeedsUpdate() } } - /// Icon Name used within the Icon within the Selected State. + /// Selected Icon Name used within the Icon if selectable true. open var selectedIconName: Icon.Name? { didSet { setNeedsUpdate() } } /// Sets the size of button icon and icon. @@ -141,7 +141,7 @@ open class ButtonIcon: Control { /// If provided, the badge indicator will present. open var showBadgeIndicator: Bool = false { didSet { setNeedsUpdate() } } - /// If provided, the button icon will have selectable Icon. + /// If true, button will be rendered as selected, when it is selectable. open var selectable: Bool = false { didSet { setNeedsUpdate() } } /// Used to move the icon inside the button in both x and y axis. @@ -154,7 +154,7 @@ open class ButtonIcon: Control { // MARK: - Configuration //-------------------------------------------------- private var iconColorConfiguration: AnyColorable { - if selectedIconName != nil { + if selectedIconName != nil, selectable { return selectedIconColorConfiguration } else { if kind == .highContrast { @@ -346,7 +346,7 @@ open class ButtonIcon: Control { hideBorder = true iconOffset = .init(x: 0, y: 0) iconName = nil -// selectableIconName = nil + selectedIconName = nil showBadgeIndicator = false selectable = false badgeIndicatorModel = nil