-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
435968f
commit d4f4b90
Showing
36 changed files
with
938 additions
and
640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
Sources/Core/DesignSystem/Layouts/StackedViewsLayout.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import Prelude | ||
|
||
public struct StackedViewsLayout: Layout { | ||
var isExpanded: Bool | ||
|
||
/// Spacing between views in Expanded state | ||
var spacing: CGFloat | ||
|
||
/// Spacing between views in Collapsed state | ||
var collapsedSpacing: CGFloat | ||
|
||
/// Number of visible views in Collapsed state | ||
var collapsedViewsCount: Int | ||
|
||
public init( | ||
isExpanded: Bool, | ||
spacing: CGFloat = .small3, | ||
collapsedSpacing: CGFloat = 10, | ||
collapsedViewsCount: Int = 3 | ||
) { | ||
self.isExpanded = isExpanded | ||
self.spacing = spacing | ||
self.collapsedSpacing = collapsedSpacing | ||
self.collapsedViewsCount = collapsedViewsCount | ||
} | ||
|
||
public static var layoutProperties: LayoutProperties { | ||
var properties = LayoutProperties() | ||
properties.stackOrientation = .vertical | ||
return properties | ||
} | ||
|
||
public func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { | ||
let container = proposal.replacingUnspecifiedDimensions() | ||
guard !subviews.isEmpty else { | ||
return container | ||
} | ||
|
||
let heights = subviews.map { $0.sizeThatFits(.init(width: container.width, height: nil)).height } | ||
let height: CGFloat = { | ||
if isExpanded { | ||
return heights.reduce(0.0, +) + spacing * CGFloat(subviews.count - 1) | ||
} else { | ||
return heights[0] + CGFloat(collapsedViewsCount - 1) * collapsedSpacing | ||
} | ||
}() | ||
return .init(width: container.width, height: height) | ||
} | ||
|
||
public func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { | ||
let container = proposal.replacingUnspecifiedDimensions() | ||
var offset: CGFloat = 0 | ||
for (index, subview) in subviews.enumerated() { | ||
let place = CGPoint(x: bounds.minX, y: bounds.minY + offset) | ||
subview.place(at: place, proposal: .init(width: container.width, height: nil)) | ||
|
||
if isExpanded { | ||
let subviewSize = subview.sizeThatFits(.init(width: container.width, height: nil)) | ||
offset += subviewSize.height + spacing | ||
} else { | ||
// The rest of the cards that go over `collapsedViewsCount` will go behind the last card. | ||
if index < collapsedViewsCount - 1 { | ||
offset += collapsedSpacing | ||
} | ||
} | ||
} | ||
} | ||
} |
70 changes: 0 additions & 70 deletions
70
Sources/Features/AccountDetailsFeature/Components/AssetsView+Reducer.swift
This file was deleted.
Oops, something went wrong.
77 changes: 0 additions & 77 deletions
77
Sources/Features/AccountDetailsFeature/Components/AssetsView+View.swift
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...countDetailsFeature/Components/NonFungibleTokenList/Components/ExpandableRow/Header.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.