From b9cdc0dc4b2a108ef62cbaa0745701a7a510b02b Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 17 Apr 2023 13:25:09 -0500 Subject: [PATCH] updated controllers Signed-off-by: Matt Bruce --- VDSSample/ViewControllers/LabelViewController.swift | 13 ++++++++++++- .../ViewControllers/TrailingTooltipLabel.swift | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/VDSSample/ViewControllers/LabelViewController.swift b/VDSSample/ViewControllers/LabelViewController.swift index 087a53a..b921ad0 100644 --- a/VDSSample/ViewControllers/LabelViewController.swift +++ b/VDSSample/ViewControllers/LabelViewController.swift @@ -17,6 +17,12 @@ class LabelViewController: BaseViewController { picker: self.picker) }() + lazy var textPositionPickerSelectorView = { + PickerSelectorView(title: TextPosition.left.rawValue, + picker: self.picker, + items: TextPosition.allCases) + }() + lazy var fontCategoryPickerSelectorView = { FontCategoryPickerSelectorView(title: "", picker: self.picker) @@ -44,6 +50,7 @@ class LabelViewController: BaseViewController { addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch)) addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch)) addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Text Position", view: textPositionPickerSelectorView) addFormRow(label: "Font Category", view: fontCategoryPickerSelectorView) addFormRow(label: "Text Size", view: textSizePickerSelectorView) addFormRow(label: "Text", view: textField) @@ -65,7 +72,7 @@ class LabelViewController: BaseViewController { self?.label.text = text }.store(in: &subscribers) } - + func setupModel() { label.text = "Label Component" label.textStyle = .featureSmall @@ -116,6 +123,10 @@ class LabelViewController: BaseViewController { self?.label.surface = item self?.contentTopView.backgroundColor = item.color } + + textPositionPickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.label.textPosition = item + } textSizePickerSelectorView.onPickerDidSelect = { [weak self] item in self?.textSize = item diff --git a/VDSSample/ViewControllers/TrailingTooltipLabel.swift b/VDSSample/ViewControllers/TrailingTooltipLabel.swift index 960e6e5..06e8d64 100644 --- a/VDSSample/ViewControllers/TrailingTooltipLabel.swift +++ b/VDSSample/ViewControllers/TrailingTooltipLabel.swift @@ -27,6 +27,12 @@ class TrailingTooltipLabelViewController: BaseViewController { picker: self.picker, items: Tooltip.Size.allCases) }() + + lazy var textPositionPickerSelectorView = { + PickerSelectorView(title: TextPosition.left.rawValue, + picker: self.picker, + items: TextPosition.allCases) + }() var boldSwitch = Toggle() var disabledSwitch = Toggle() @@ -55,6 +61,7 @@ class TrailingTooltipLabelViewController: BaseViewController { addFormRow(label: "Disabled", view: .makeWrapper(for: disabledSwitch)) addFormRow(label: "Bold", view: .makeWrapper(for: boldSwitch)) addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Text Position", view: textPositionPickerSelectorView) addFormRow(label: "Font Category", view: fontCategoryPickerSelectorView) addFormRow(label: "Text Size", view: textSizePickerSelectorView) addFormRow(label: "Text", view: textField) @@ -162,10 +169,14 @@ class TrailingTooltipLabelViewController: BaseViewController { self?.contentTopView.backgroundColor = item.color } + textPositionPickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.tooltipLabel.labelTextPosition = item + } + textSizePickerSelectorView.onPickerDidSelect = { [weak self] item in self?.textSize = item } - + fontCategoryPickerSelectorView.onPickerDidSelect = { [weak self] item in self?.fontCategory = item }