From a7d777a97d2c9eb621eb7b8e5a29bed7332e4d8a Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 10 May 2024 10:30:37 -0500 Subject: [PATCH] refactored more for the naming Signed-off-by: Matt Bruce --- .../DropdownSelect/DropdownSelect.swift | 2 +- .../TextFields/EntryFieldBase.swift | 33 ++++++++----------- .../TextFields/InputField/InputField.swift | 2 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/VDS/Components/DropdownSelect/DropdownSelect.swift b/VDS/Components/DropdownSelect/DropdownSelect.swift index 6476819d..c401267e 100644 --- a/VDS/Components/DropdownSelect/DropdownSelect.swift +++ b/VDS/Components/DropdownSelect/DropdownSelect.swift @@ -263,7 +263,7 @@ open class DropdownSelect: EntryFieldBase { //set the helper label position if helperText != nil { if helperTextPlacement == .right { - middleStackView.spacing = 12 + middleStackView.spacing = VDSLayout.space3X middleStackView.distribution = .fillEqually middleStackView.addArrangedSubview(helperLabel) } else { diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index 0581c4bb..44993c39 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -40,19 +40,6 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- - ///This is the stackView that is the first subView of the EntryFieldBase, that will - ///layout the following hierarchy - /// - ///- primaryStackView (vertical) - ///---- titleLabel - ///---- containerView (has the border for the user to interact with. - ///------ containerHorizontal - ///--------- fieldContainerView (subclass implements, ie UITextField, UITextView, etc...) - ///--------- statusIcon (error, succes, or overridden by dev) - ///---- UIView (getBottomContainer) - ///------ bottomContainerStackView (vertical) - ///------- errorLabel - ///--------helpLabel internal var stackView: UIStackView = { return UIStackView().with { $0.translatesAutoresizingMaskIntoConstraints = false @@ -91,6 +78,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { $0.translatesAutoresizingMaskIntoConstraints = false $0.axis = .vertical $0.distribution = .fill + $0.spacing = VDSLayout.space2X } }() @@ -229,9 +217,18 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { widthConstraint = containerView.widthAnchor.constraint(equalToConstant: 0) widthConstraint?.priority = .defaultHigh + let leftStackView = UIStackView().with { + $0.translatesAutoresizingMaskIntoConstraints = false + $0.axis = .vertical + $0.distribution = .fill + $0.alignment = .leading + } + leftStackView.addArrangedSubview(containerView) + leftStackView.setCustomSpacing(8, after: containerView) + //add the containerView to the middleStack - middleStackView.addArrangedSubview(containerView) - + middleStackView.addArrangedSubview(leftStackView) + //add ContainerStackView //this is the horizontal stack that contains //the left, InputContainer, Icons, Buttons @@ -249,18 +246,16 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { //get the container this is what show helper text, error text //can include other for character count, max length let bottomContainer = getBottomContainer() - + //this is the vertical stack that contains error text, helper text bottomContainerStackView.addArrangedSubview(errorLabel) bottomContainerStackView.addArrangedSubview(helperLabel) stackView.addArrangedSubview(titleLabel) stackView.addArrangedSubview(middleStackView) - stackView.addArrangedSubview(bottomContainer) + leftStackView.addArrangedSubview(bottomContainer) stackView.setCustomSpacing(4, after: titleLabel) - stackView.setCustomSpacing(8, after: middleStackView) - stackView.setCustomSpacing(8, after: bottomContainer) stackView .pinTop() diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index 62181d69..9150ae6d 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -270,7 +270,7 @@ open class InputField: EntryFieldBase { //set the helper label position if helperText != nil { if helperTextPlacement == .right { - middleStackView.spacing = 12 + middleStackView.spacing = VDSLayout.space3X middleStackView.distribution = .fillEqually middleStackView.addArrangedSubview(helperLabel) } else {