story:ONEAPP-6315: show badge variants
This commit is contained in:
parent
b2e7d217bd
commit
dda7d2f598
@ -58,6 +58,7 @@ class ButtonIconViewController: BaseViewController<ButtonIcon> {
|
|||||||
var disabledSwitch = Toggle()
|
var disabledSwitch = Toggle()
|
||||||
var selectableSwitch = Toggle()
|
var selectableSwitch = Toggle()
|
||||||
var badgeIndicatorSwitch = Toggle()
|
var badgeIndicatorSwitch = Toggle()
|
||||||
|
var variantOneSwitch = Toggle()
|
||||||
|
|
||||||
lazy var badgeIndicatorExpandDirectionPickerSelectorView = {
|
lazy var badgeIndicatorExpandDirectionPickerSelectorView = {
|
||||||
PickerSelectorView(title: "right",
|
PickerSelectorView(title: "right",
|
||||||
@ -74,7 +75,6 @@ class ButtonIconViewController: BaseViewController<ButtonIcon> {
|
|||||||
|
|
||||||
override func setupForm(){
|
override func setupForm(){
|
||||||
super.setupForm()
|
super.setupForm()
|
||||||
// addActionRow()
|
|
||||||
addFormRow(label: "Disabled", view: disabledSwitch)
|
addFormRow(label: "Disabled", view: disabledSwitch)
|
||||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||||
addFormRow(label: "Surface Type", view: surfaceTypePickerSelectorView)
|
addFormRow(label: "Surface Type", view: surfaceTypePickerSelectorView)
|
||||||
@ -91,12 +91,27 @@ class ButtonIconViewController: BaseViewController<ButtonIcon> {
|
|||||||
addFormRow(label: "Y Offset", view: centerY)
|
addFormRow(label: "Y Offset", view: centerY)
|
||||||
addFormRow(label: "Show Badge Indicator", view: badgeIndicatorSwitch)
|
addFormRow(label: "Show Badge Indicator", view: badgeIndicatorSwitch)
|
||||||
addFormRow(label: "Expand Direction", view: badgeIndicatorExpandDirectionPickerSelectorView)
|
addFormRow(label: "Expand Direction", view: badgeIndicatorExpandDirectionPickerSelectorView)
|
||||||
|
addFormRow(label: "Badge Variants", view: variantOneSwitch)
|
||||||
|
|
||||||
|
variantOneSwitch.onChange = { [weak self] sender in
|
||||||
|
guard let self else { return }
|
||||||
|
if sender.isOn {
|
||||||
|
if badgeIndicatorSwitch.isOn {
|
||||||
|
component.badgeIndicatorModel = ButtonIcon.BadgeIndicatorModel(kind: BadgeIndicator.Kind.simple, size: BadgeIndicator.Size.small)
|
||||||
|
} else {
|
||||||
|
component.badgeIndicatorModel = nil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
component.badgeIndicatorModel = ButtonIcon.BadgeIndicatorModel(kind: BadgeIndicator.Kind.numbered, size: BadgeIndicator.Size.small, maximumDigits: BadgeIndicator.MaximumDigits.two, number: 999, trailingText: "New")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
badgeIndicatorSwitch.onChange = { [weak self] sender in
|
badgeIndicatorSwitch.onChange = { [weak self] sender in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
self.component.showBadgeIndicator = sender.isOn
|
self.component.showBadgeIndicator = sender.isOn
|
||||||
self.setBadgeIndicatorModel()
|
self.setBadgeIndicatorModel()
|
||||||
self.component.badgeIndicator.isHidden = !sender.isOn
|
self.component.badgeIndicator.isHidden = !sender.isOn
|
||||||
|
variantOneSwitch.isOn = false
|
||||||
}
|
}
|
||||||
|
|
||||||
disabledSwitch.onChange = { [weak self] sender in
|
disabledSwitch.onChange = { [weak self] sender in
|
||||||
@ -148,7 +163,7 @@ class ButtonIconViewController: BaseViewController<ButtonIcon> {
|
|||||||
//sub models
|
//sub models
|
||||||
func setBadgeIndicatorModel() {
|
func setBadgeIndicatorModel() {
|
||||||
if badgeIndicatorSwitch.isOn {
|
if badgeIndicatorSwitch.isOn {
|
||||||
component.badgeIndicatorModel = ButtonIcon.BadgeIndicatorModel(kind: BadgeIndicator.Kind.numbered, size: BadgeIndicator.Size.small, maximumDigits: BadgeIndicator.MaximumDigits.three, number: 9999, trailingText: "New")
|
component.badgeIndicatorModel = ButtonIcon.BadgeIndicatorModel(kind: BadgeIndicator.Kind.numbered, size: BadgeIndicator.Size.small, maximumDigits: BadgeIndicator.MaximumDigits.two, number: 999)
|
||||||
} else {
|
} else {
|
||||||
component.badgeIndicatorModel = nil
|
component.badgeIndicatorModel = nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user