From 014ff31f298214e0bfbf21f63228e6b915381d88 Mon Sep 17 00:00:00 2001 From: Juan David Hurtado Date: Mon, 13 Jun 2022 12:10:21 -0500 Subject: [PATCH 1/3] feat: add collection card subtitle --- .../Examples/Complex/CollectionCardExample.swift | 1 + .../Collection Card/PuraceCollectionCardData.swift | 2 ++ .../Collection Card/PuraceCollectionCardView.swift | 10 +++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift b/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift index 55314fb..62d4e8c 100644 --- a/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift +++ b/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift @@ -33,6 +33,7 @@ struct MockCard: PuraceCollectionCardData { var deepLink: String = "" var backgroundImage: URL? var title: String = "Froilán Largacha Hurtado" + var subtitle: String = "From the Palace of Versailles to the Florida Kahlo museum" init(_ url: String) { self.backgroundImage = URL(string: url) diff --git a/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardData.swift b/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardData.swift index 6d66783..7da3aee 100644 --- a/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardData.swift +++ b/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardData.swift @@ -15,4 +15,6 @@ public protocol PuraceCollectionCardData { var backgroundImage: URL? { get } /// Card's title var title: String { get } + /// Card's subtitle + var subtitle: String { get } } diff --git a/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift b/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift index 85b78a2..a5af7cb 100644 --- a/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift +++ b/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift @@ -80,10 +80,14 @@ public struct PuraceCollectionCardView: View { PuraceImageView(url: cards[index].backgroundImage) { ZStack { LinearGradient(gradient: Gradient(colors: [.clear, .black.opacity(0.35)]), startPoint: .top, endPoint: .center) - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: 15) { Spacer() HStack { - PuraceTextView(cards[index].title, fontSize: 12, textColor: .white, weight: .medium) + PuraceTextView(cards[index].title, fontSize: 18, textColor: .white, weight: .regular) + Spacer(minLength: 0) + } + HStack { + PuraceTextView(cards[index].subtitle, fontSize: 12, textColor: .white, weight: .regular) Spacer(minLength: 0) } }.padding() @@ -114,7 +118,7 @@ public struct PuraceCollectionCardView: View { } }) .onEnded({ value in - if dragOpacity < 0.55 { + if dragOpacity < 0.75 { next() lastCardOpacity = 0 withAnimation(.linear(duration: 0.2).delay(0.4)) { From d89c2eebb532c02ab4d9ae45373d9ca030f35784 Mon Sep 17 00:00:00 2001 From: Juan David Hurtado Date: Mon, 13 Jun 2022 12:48:24 -0500 Subject: [PATCH 2/3] feat: add card subtitle line limit --- .../Views/Complex/Collection Card/PuraceCollectionCardView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift b/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift index a5af7cb..c4b8f90 100644 --- a/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift +++ b/Sources/Purace/Views/Complex/Collection Card/PuraceCollectionCardView.swift @@ -88,6 +88,7 @@ public struct PuraceCollectionCardView: View { } HStack { PuraceTextView(cards[index].subtitle, fontSize: 12, textColor: .white, weight: .regular) + .lineLimit(2) Spacer(minLength: 0) } }.padding() From 33b4c43fbb79d5f76407080bfa9ace3a03f8ecc1 Mon Sep 17 00:00:00 2001 From: Juan David Hurtado Date: Mon, 13 Jun 2022 12:51:29 -0500 Subject: [PATCH 3/3] chore: update card collection example --- .../PuraceDemo/Examples/Complex/CollectionCardExample.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift b/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift index 62d4e8c..f6059d1 100644 --- a/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift +++ b/PuraceDemo/PuraceDemo/Examples/Complex/CollectionCardExample.swift @@ -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.8), + firstCardSize: .init(width: UIScreen.main.bounds.width * 0.7, height: UIScreen.main.bounds.width * 0.85), 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"), @@ -33,7 +33,7 @@ struct MockCard: PuraceCollectionCardData { var deepLink: String = "" var backgroundImage: URL? var title: String = "Froilán Largacha Hurtado" - var subtitle: String = "From the Palace of Versailles to the Florida Kahlo museum" + var subtitle: String = "From the Palacsdfdfsfdsfdffsfsfsddf sfs f e of Versailles to the Florida Kahlo museum" init(_ url: String) { self.backgroundImage = URL(string: url)