Skip to content

Commit

Permalink
Merge pull request #19 from juandahurt/improvement
Browse files Browse the repository at this point in the history
refactor: improve card collection ui
  • Loading branch information
juandahurt authored Jun 18, 2022
2 parents 2f5efce + f8d4d8d commit 67d65cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct CollectionCardExample: View {
Text("`PuraceCollectionCardView(cards: ...)`")
.padding()
PuraceCollectionCardView(
firstCardSize: .init(width: UIScreen.main.bounds.width * 0.7, height: UIScreen.main.bounds.width * 0.85),
firstCardSize: .init(width: UIScreen.main.bounds.height * 0.35, height: UIScreen.main.bounds.width * 0.9),
cards: [
MockCard("https://www.biografiasyvidas.com/biografia/c/fotos/caldas_francisco_jose_2.jpg"),
MockCard("https://upload.wikimedia.org/wikipedia/commons/a/ac/Froil%C3%A1n_Largacha_Hurtado.jpg"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public struct PuraceCollectionCardView: View {
if index == numberOfCards - 2 {
minOffset = 0
} else {
minOffset = CGFloat((numberOfCards - index - 1) * 15)
minOffset = CGFloat((numberOfCards - index - 1) * 25)
}
return max(CGFloat((numberOfCards - index) * 15) + dragOffset.width * 0.5, minOffset)
return max(CGFloat((numberOfCards - index) * 25) + dragOffset.width * 0.5, minOffset)
}

func card(at index: Int) -> some View {
Expand All @@ -96,9 +96,9 @@ public struct PuraceCollectionCardView: View {
}
.aspectRatio(contentMode: .fill)
.frame(width: getSize(at: index).width, height: getSize(at: index).height)
.cornerRadius(5)
.cornerRadius(15)
.opacity(getCardOpacity(forCardAt: index))
.offset(x: getHorizontalOffset(forCardAt: index), y: 0)
.offset(x: getHorizontalOffset(forCardAt: index) - 15, y: 0)
.offset(x: index == numberOfCards - 1 ? dragOffset.width : .zero, y: .zero)
.onTapGesture {
if index == numberOfCards - 1 {
Expand Down

0 comments on commit 67d65cf

Please sign in to comment.