Skip to content

Commit

Permalink
add extra gradient previews (#4750)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkVillacampa authored Jan 30, 2025
1 parent cf8ae65 commit 55dedb7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions RevenueCatUI/Views/GradientView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ struct GradientView: View {
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct GradientView_Previews: PreviewProvider {

static private func gradientView(style: GradientView.GradientStyle) -> some View {
GradientView(
lightGradient: .init(colors: .init([.red, .black])),
darkGradient: .init(colors: .init([.blue, .black])),
gradientStyle: style
)
}

static var previews: some View {
GradientView(
lightGradient: .init(colors: .init([.red, .white])),
Expand Down Expand Up @@ -95,6 +103,25 @@ struct GradientView_Previews: PreviewProvider {
)
.previewLayout(.sizeThatFits)
.previewDisplayName("Linear 90º - Light (should be red)")

VStack {
Text("Linear 0º")
gradientView(style: .linear(0))
Text("Linear 45º")
gradientView(style: .linear(45))
Text("Linear 90º")
gradientView(style: .linear(90))
Text("Linear 135º")
gradientView(style: .linear(135))
Text("Linear 180º")
gradientView(style: .linear(180))
Text("Linear 225º")
gradientView(style: .linear(225))
Text("Linear 270º")
gradientView(style: .linear(270))
}
.previewLayout(.sizeThatFits)
.previewDisplayName("Linear")
}

}
Expand Down

0 comments on commit 55dedb7

Please sign in to comment.