Skip to content

Commit

Permalink
fix spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Sep 5, 2024
1 parent f304abf commit ef090d2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions HabitRPG/UI/Purchases/SubscriptionOptionViewUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
//
import SwiftUI


struct HourglassPromo: View {
@State private var animatePromoGradient = false

var body: some View {
private var content: some View {
let offset = animatePromoGradient ? 0.5 : -0.5
Spacer()
Group {
return Group {
Text("Get ") +
Text("12 Mystic Hourglasses").fontWeight(.bold) +
Text("immediately after your first 12 month subscription!")
Expand All @@ -29,10 +27,18 @@ struct HourglassPromo: View {
Gradient.Stop(color: Color(hexadecimal: "72CFFF"), location: offset + 1.0)],
startPoint: .leading,
endPoint: .trailing))
.onAppear {
withAnimation(.easeInOut(duration: 2.5).repeatForever(autoreverses: true)) {
animatePromoGradient = true
}
}

var body: some View {
if #available(iOS 15.0, *) {
content
.task {
withAnimation(.easeInOut(duration: 2.5).repeatForever(autoreverses: true)) {
animatePromoGradient = true
}
}
} else {
content
}
}
}
Expand Down Expand Up @@ -115,6 +121,7 @@ struct SubscriptionOptionViewUI<Price: View, Recurring: View, Tag: View>: View {
.padding(.top, 16)
.padding(.leading, 30)

Spacer()
if showHourglassPromo {
HourglassPromo()
}
Expand Down

0 comments on commit ef090d2

Please sign in to comment.