From 868c728f63a40b3a66eb38185b934154cefe9b88 Mon Sep 17 00:00:00 2001 From: vasavk Date: Tue, 19 Mar 2024 17:33:19 +0530 Subject: [PATCH] Digital ACT-191 ONEAPP-6827 story: container size changes --- VDS/Components/Breadcrumbs/Breadcrumbs.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Breadcrumbs/Breadcrumbs.swift b/VDS/Components/Breadcrumbs/Breadcrumbs.swift index b69e5ead..94d6e6fe 100644 --- a/VDS/Components/Breadcrumbs/Breadcrumbs.swift +++ b/VDS/Components/Breadcrumbs/Breadcrumbs.swift @@ -38,6 +38,11 @@ open class Breadcrumbs: View { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- + // Sizes are from InVision design specs. + internal var containerSize: CGSize { CGSize(width: 45, height: 44) } + + internal var heightConstraint: NSLayoutConstraint? + let layout: UICollectionViewFlowLayout = LeftAlignedCollectionViewFlowLayout().with { $0.estimatedItemSize = UICollectionViewFlowLayout.automaticSize $0.minimumInteritemSpacing = VDSLayout.Spacing.space1X.value @@ -60,12 +65,16 @@ open class Breadcrumbs: View { return collectionView }() - //-------------------------------------------------- + //------------------------------------------s-------- // MARK: - Overrides //-------------------------------------------------- /// 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() + //create the wrapping view + heightConstraint = self.heightAnchor.constraint(equalToConstant: containerSize.height) + heightConstraint?.priority = .defaultHigh + heightConstraint?.isActive = true } /// Executed on initialization for this View. @@ -73,7 +82,6 @@ open class Breadcrumbs: View { super.initialSetup() addSubview(collectionView) collectionView.pinToSuperView() - collectionView.heightAnchor.constraint(equalToConstant: 80).activate() } /// Resets to default settings. @@ -89,6 +97,8 @@ open class Breadcrumbs: View { open override func updateView() { super.updateView() collectionView.reloadData() + heightConstraint?.constant = collectionView.collectionViewLayout.collectionViewContentSize.height + heightConstraint?.isActive = true } open override func layoutSubviews() {