From 2e0d0be8b68786b9be98add64b9576be1771a139 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 18 Mar 2024 10:53:42 -0500 Subject: [PATCH] left aligned content for scenarios to where the container is stretched. Signed-off-by: Matt Bruce --- VDS/Components/Buttons/TextLink/TextLink.swift | 4 ++++ VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/VDS/Components/Buttons/TextLink/TextLink.swift b/VDS/Components/Buttons/TextLink/TextLink.swift index dcb4a46d..1b1f79e8 100644 --- a/VDS/Components/Buttons/TextLink/TextLink.swift +++ b/VDS/Components/Buttons/TextLink/TextLink.swift @@ -87,6 +87,10 @@ open class TextLink: ButtonBase { isAccessibilityElement = true accessibilityTraits = .link + //left align titleLabel in case this is pinned leading/trailing + //default is always set to center + contentHorizontalAlignment = .left + if let titleLabel { addSubview(line) line.pinLeading(titleLabel.leadingAnchor) diff --git a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift index aaa9f3cb..eb3776ea 100644 --- a/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift +++ b/VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift @@ -79,6 +79,11 @@ open class TextLinkCaret: ButtonBase { /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. open override func setup() { super.setup() + + //left align titleLabel in case this is pinned leading/trailing + //default is always set to center + contentHorizontalAlignment = .left + accessibilityTraits = .link titleLabel?.numberOfLines = 0 titleLabel?.lineBreakMode = .byWordWrapping