Merge branch 'feature/atomic_vds_tabs' into feature/vds_batch_two
This commit is contained in:
commit
89daf16d29
@ -68,6 +68,7 @@ import VDS
|
||||
size = viewModel.size
|
||||
selectedIndex = viewModel.selectedIndex
|
||||
surface = viewModel.style ?? .light
|
||||
fillContainer = viewModel.fillContainer
|
||||
tabModels = viewModel.tabs.compactMap { TabModel(text: $0.label.text) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ open class TabsModel: MoleculeModelProtocol {
|
||||
open var orientation: Tabs.Orientation = .horizontal
|
||||
open var indicatorPosition: Tabs.IndicatorPosition = .bottom
|
||||
open var overflow: Tabs.Overflow = .scroll
|
||||
open var fillContainer: Bool = false
|
||||
open var size: Tabs.Size = .medium
|
||||
public var backgroundColor: Color?
|
||||
|
||||
@ -35,6 +36,7 @@ open class TabsModel: MoleculeModelProtocol {
|
||||
case selectedIndex
|
||||
case orientation
|
||||
case indicatorPosition
|
||||
case fillContainer
|
||||
case overflow
|
||||
case size
|
||||
case style
|
||||
@ -49,6 +51,11 @@ open class TabsModel: MoleculeModelProtocol {
|
||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||
tabs = try typeContainer.decode([TabItemModel].self, forKey: .tabs)
|
||||
style = try typeContainer.decodeIfPresent(Surface.self, forKey: .style)
|
||||
|
||||
if let fillContainer = try typeContainer.decodeIfPresent(Bool.self, forKey: .fillContainer) {
|
||||
self.fillContainer = fillContainer
|
||||
}
|
||||
|
||||
if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedIndex) {
|
||||
selectedIndex = index
|
||||
}
|
||||
@ -76,6 +83,7 @@ open class TabsModel: MoleculeModelProtocol {
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(tabs, forKey: .tabs)
|
||||
try container.encode(selectedIndex, forKey: .selectedIndex)
|
||||
try container.encode(fillContainer, forKey: .fillContainer)
|
||||
try container.encodeIfPresent(style, forKey: .style)
|
||||
try container.encode(orientation, forKey: .orientation)
|
||||
try container.encode(overflow, forKey: .overflow)
|
||||
|
||||
@ -11,7 +11,9 @@ import MVMCore
|
||||
import VDSColorTokens
|
||||
|
||||
open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol, TabsDelegate, MVMCorePresentationDelegateProtocol, SubNavSwipeNavigationProtocol {
|
||||
|
||||
/// The number of tabs count or less that will turn on the fillContainer
|
||||
public var fillContainerTabsCount = 2 { didSet { tabs.fillContainer = tabsModel.tabs.count <= fillContainerTabsCount }}
|
||||
|
||||
/// The current managed view controller
|
||||
private var viewController: UIViewController
|
||||
|
||||
@ -31,7 +33,6 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
|
||||
public lazy var tabs: Tabs = {
|
||||
let tabs = Tabs(model: tabsModel, delegateObjectIVar, nil)
|
||||
tabs.backgroundColor = (viewController as? PageProtocol)?.pageModel?.navigationBar?.backgroundColor?.uiColor ?? VDSColor.backgroundPrimaryLight
|
||||
tabs.fillContainer = true
|
||||
tabs.delegate = self
|
||||
return tabs
|
||||
}()
|
||||
@ -71,6 +72,7 @@ open class SubNavManagerController: ViewController, MVMCoreViewManagerProtocol,
|
||||
func setup(with loadObject: MVMCoreLoadObject, shouldEnableSwipeGestures: Bool) {
|
||||
self.loadObject = loadObject
|
||||
pageType = loadObject.pageType
|
||||
tabs.fillContainer = tabsModel.tabs.count <= fillContainerTabsCount
|
||||
if shouldEnableSwipeGestures {
|
||||
customInteractor = SubNavInteractor(viewController: self)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user