From 09351db136475267e2eef9ec0651d7b73db8a5e8 Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Thu, 12 Sep 2024 13:26:06 +0530 Subject: [PATCH] Digital ACT-191 ONEAPP-10586 story: updated symbolType to use as String, camelCase applied to footnoteItems --- VDS/Components/Footnote/Footnote.swift | 27 +++------------------ VDS/Components/Footnote/FootnoteGroup.swift | 18 +++++++------- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/VDS/Components/Footnote/Footnote.swift b/VDS/Components/Footnote/Footnote.swift index 0d1575f0..8583a05b 100644 --- a/VDS/Components/Footnote/Footnote.swift +++ b/VDS/Components/Footnote/Footnote.swift @@ -72,27 +72,6 @@ open class Footnote: View { } } - /// Enum used to describe the symboldType of component. - public enum SymbolType: String, DefaultValuing, CaseIterable { - case asterisk - case doubleAsterisk - case character - - public static var defaultValue: Self { .asterisk } - - /// TextStyle relative to Size. - public var text: String { - switch self { - case .asterisk: - return "*" - case .doubleAsterisk: - return "**" - case .character: - return "1." - } - } - } - /// Enum used to describe the width of a fixed value or percentage of parent's width. public enum Width { case percentage(CGFloat) @@ -111,8 +90,8 @@ open class Footnote: View { /// If hideSymbol true, the component will show text without symbol. open var hideSymbol: Bool = false { didSet { setNeedsUpdate() } } - /// Size of the component. The default size is Micro. - open var symbolType: SymbolType = .defaultValue { didSet { setNeedsUpdate() } } + /// symbol type will be shown for the footnote item. The default symbolType is 'asterisk'. + open var symbolType: String = "*" { didSet { setNeedsUpdate() } } /// Text of the footnote item. open var text: String? { didSet { setNeedsUpdate() } } @@ -232,7 +211,7 @@ open class Footnote: View { // Update symbolLabel symbolWidthConstraint?.isActive = false - symbolLabel.text = hideSymbol ? "" : symbolType.text + symbolLabel.text = hideSymbol ? "" : symbolType symbolLabel.textColor = kind.colorConfiguration.getColor(self) symbolLabel.textStyle = size.textStyle.regular symbolLabel.surface = surface diff --git a/VDS/Components/Footnote/FootnoteGroup.swift b/VDS/Components/Footnote/FootnoteGroup.swift index 755ed9aa..0f229ac8 100644 --- a/VDS/Components/Footnote/FootnoteGroup.swift +++ b/VDS/Components/Footnote/FootnoteGroup.swift @@ -42,7 +42,7 @@ open class FootnoteGroup: View { // MARK: - Public Properties //-------------------------------------------------- /// Array of ``Footnote`` for the Footnote items. - open var footnoteitems: [Footnote] = [] { didSet { setNeedsUpdate() } } + open var footnoteItems: [Footnote] = [] { didSet { setNeedsUpdate() } } /// Any percentage or pixel value and cannot exceed container size. /// If there is a width that is larger than container size, the footnote will resize to container's width. @@ -116,7 +116,7 @@ open class FootnoteGroup: View { open override func setDefaults() { super.setDefaults() width = nil - footnoteitems = [] + footnoteItems = [] } /// Resets to default settings. @@ -131,19 +131,19 @@ open class FootnoteGroup: View { // symbol containers are as wide as the widest symbol container in the group. var symbolMaxWidth = 0.0 - if footnoteitems.count > 0 { - for index in 0...footnoteitems.count - 1 { - let footnote: Footnote = footnoteitems[index] - let separatorWidth = Label().with { $0.text = footnote.symbolType.text; $0.sizeToFit() }.intrinsicContentSize.width + if footnoteItems.count > 0 { + for index in 0...footnoteItems.count - 1 { + let footnote: Footnote = footnoteItems[index] + let separatorWidth = Label().with { $0.text = footnote.symbolType; $0.sizeToFit() }.intrinsicContentSize.width symbolMaxWidth = separatorWidth > symbolMaxWidth ? separatorWidth : symbolMaxWidth } } stackView.subviews.forEach{$0.removeFromSuperview()} // add symbol label, text label to stack. - if footnoteitems.count > 0 { - for index in 0...footnoteitems.count - 1 { - let footnote: Footnote = footnoteitems[index] + if footnoteItems.count > 0 { + for index in 0...footnoteItems.count - 1 { + let footnote: Footnote = footnoteItems[index] footnote.symbolWiderWidth = symbolMaxWidth footnote.surface = surface stackView.addArrangedSubview(footnote)