From 7fc4d1b2b22be2f162617c15714312382fba6b6e Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 28 Aug 2023 12:01:42 -0500 Subject: [PATCH] more comments Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 6 +++++- VDS/Components/BadgeIndicator/BadgeIndicator.swift | 2 +- VDS/Components/Buttons/Button/Button.swift | 14 ++++++++++++-- .../Buttons/ButtonGroup/ButtonGroup.swift | 1 + VDS/Components/Buttons/TextLink/TextLink.swift | 9 ++++++++- .../Buttons/TextLinkCaret/TextLinkCaret.swift | 7 +++++++ 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index a1636e0a..b34dfc04 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -11,7 +11,11 @@ import VDSColorTokens import VDSFormControlsTokens import Combine -/// Badges are visual labels used to convey status or highlight supplemental information. +/// A badge is a visual label used to convey status or highlight supplemental information. +/// +/// If you are using AutoLayoutConstraints you have a combination of Leading/Left and Trailing/Right NSLayoutConstraints, +/// you need to ensure that one of these Horizontal Contraints is not constraint of "equatTo". If you are to pin the left/right edges +/// to its parent this object will stretch to the parent's width. @objc(VDSBadge) open class Badge: View { //-------------------------------------------------- diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index 5894afcc..729a62c6 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -12,7 +12,7 @@ import VDSFormControlsTokens import Combine import VDSTypographyTokens -/// Badge Indicators are visual labels . +/// A badge indicator is a visual label used to convey status or highlight supplemental information. @objc(VDSBadgeIndicator) open class BadgeIndicator: View { //-------------------------------------------------- diff --git a/VDS/Components/Buttons/Button/Button.swift b/VDS/Components/Buttons/Button/Button.swift index b895e33c..7a01cdc4 100644 --- a/VDS/Components/Buttons/Button/Button.swift +++ b/VDS/Components/Buttons/Button/Button.swift @@ -16,6 +16,11 @@ public enum ButtonSize: String, CaseIterable { case small } +/// A button is an interactive element that triggers an action. Buttons are prominent and attention-getting, with more visual emphasis than any of the Text Link components. For this reason, buttons are best suited for critical and driving actions. This class can be used within a ``ButtonGroup``. +/// +/// If you are using AutoLayoutConstraints you have a combination of Leading/Left and Trailing/Right NSLayoutConstraints, +/// you need to ensure that one of these Horizontal Contraints is not constraint of "equatTo". If you are to pin the left/right edges +/// to its parent this object will stretch to the parent's width. @objc(VDSButton) open class Button: ButtonBase, Useable { @@ -27,13 +32,18 @@ open class Button: ButtonBase, Useable { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + /// The ButtonSize available to this type of Buttonable. open override var availableSizes: [ButtonSize] { [.large, .small] } - open var use: Use = .primary { didSet { setNeedsUpdate() }} - + /// The ButtonSize for ths Button. open var size: ButtonSize = .large { didSet { setNeedsUpdate() }} + + /// The Use for this Button. + open var use: Use = .primary { didSet { setNeedsUpdate() }} private var _width: CGFloat? = nil + + /// If there is a width that is larger than this size's minmumWidth, the button will resize to this width. open var width: CGFloat? { get { _width } set { diff --git a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift index 8f1e7864..8df8e82b 100644 --- a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift +++ b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift @@ -11,6 +11,7 @@ import VDSColorTokens import VDSFormControlsTokens import Combine +/// A button group contains combinations of related CTAs including ``Button``, ``TextLink``, and ``TextLinkCaret``. This group component controls a combination's orientation, spacing, size and allowable size pairings. @objc(VDSButtonGroup) open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UICollectionViewDelegate, ButtongGroupPositionLayoutDelegate { diff --git a/VDS/Components/Buttons/TextLink/TextLink.swift b/VDS/Components/Buttons/TextLink/TextLink.swift index 303ebc84..40424978 100644 --- a/VDS/Components/Buttons/TextLink/TextLink.swift +++ b/VDS/Components/Buttons/TextLink/TextLink.swift @@ -11,6 +11,12 @@ import VDSColorTokens import VDSFormControlsTokens import Combine +/// A text link is an interactive element that navigates a customer to pages within an experience, like a “Bill details” page, or triggers a secondary action, +/// like canceling a task. This class can be used within a ``ButtonGroup``. +/// +/// If you are using AutoLayoutConstraints you have a combination of Leading/Left and Trailing/Right NSLayoutConstraints, +/// you need to ensure that one of these Horizontal Contraints is not constraint of "equatTo". If you are to pin the left/right edges +/// to its parent this object will stretch to the parent's width. @objc(VDSTextLink) open class TextLink: ButtonBase { @@ -27,7 +33,8 @@ open class TextLink: ButtonBase { // MARK: - Properties //-------------------------------------------------- open var size: ButtonSize = .large { didSet { setNeedsUpdate() }} - + + /// The ButtonSize available to this type of Buttonable. open override var availableSizes: [ButtonSize] { [.large, .small] } open override var textStyle: TextStyle { diff --git a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift index 6823c2f5..8c20672f 100644 --- a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift +++ b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift @@ -11,6 +11,12 @@ import VDSColorTokens import VDSFormControlsTokens import Combine +/// A text link caret is an interactive element that always brings a customer to another page. It's used for navigation, +/// like "Back", or a call-to-action for a product or feature, like "Shop smartphones". This class can be used within a ``ButtonGroup``. +/// +/// If you are using AutoLayoutConstraints you have a combination of Leading/Left and Trailing/Right NSLayoutConstraints, +/// you need to ensure that one of these Horizontal Contraints is not constraint of "equatTo". If you are to pin the left/right edges +/// to its parent this object will stretch to the parent's width. @objc(VDSTextLinkCaret) open class TextLinkCaret: ButtonBase { @@ -38,6 +44,7 @@ open class TextLinkCaret: ButtonBase { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + /// The ButtonSize available to this type of Buttonable. public override var availableSizes: [ButtonSize] { [.large] } open var iconPosition: IconPosition = .right { didSet { setNeedsUpdate() } }