commit 90818c12e8548b820785bab4844cc5e7c05791ae
parent 1136808afa4f30a2002c051756fefb8a05cda656
Author: William Casarin <jb55@jb55.com>
Date: Thu, 13 Jul 2023 07:09:34 -0700
components: create PinkGradientView and use PinkGradient directly
Still need to do this for the other gradients as well but this is fine
for now.
Diffstat:
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/damus/Components/GradientButtonStyle.swift b/damus/Components/GradientButtonStyle.swift
@@ -14,7 +14,7 @@ struct GradientButtonStyle: ButtonStyle {
.foregroundColor(Color.white)
.background {
RoundedRectangle(cornerRadius: 12)
- .fill(PinkGradient.gradient)
+ .fill(PinkGradient)
}
.scaleEffect(configuration.isPressed ? 0.8 : 1)
}
diff --git a/damus/Components/Gradients/PinkGradient.swift b/damus/Components/Gradients/PinkGradient.swift
@@ -11,20 +11,18 @@ fileprivate let damus_grad_c1 = hex_col(r: 0xd3, g: 0x4c, b: 0xd9)
fileprivate let damus_grad_c2 = hex_col(r: 0xf8, g: 0x69, b: 0xb6)
fileprivate let pink_grad = [damus_grad_c1, damus_grad_c2]
-struct PinkGradient: View {
+let PinkGradient = LinearGradient(colors: pink_grad, startPoint: .topTrailing, endPoint: .bottom)
+
+struct PinkGradientView: View {
var body: some View {
- PinkGradient.gradient
+ PinkGradient
.edgesIgnoringSafeArea([.top,.bottom])
}
-
- static var gradient: LinearGradient {
- LinearGradient(colors: pink_grad, startPoint: .topTrailing, endPoint: .bottom)
- }
}
-struct PinkGradient_Previews: PreviewProvider {
+struct PinkGradientView_Previews: PreviewProvider {
static var previews: some View {
- PinkGradient()
+ PinkGradientView()
}
}