refactor: introduce PurpleBackdrop

We mainly want to use this to improve previews for now, but might be
useful in the future.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-03-04 14:03:53 +00:00
parent 184fc865bb
commit c6e37bd864
3 changed files with 35 additions and 8 deletions

View File

@@ -44,14 +44,7 @@ struct DamusPurpleView: View, DamusPurpleStoreKitManagerDelegate {
var body: some View {
NavigationView {
ZStack {
Color.black
.edgesIgnoringSafeArea(.all)
Image("purple-blue-gradient-1")
.resizable()
.edgesIgnoringSafeArea(.all)
PurpleBackdrop {
ScrollView {
MainContent
.padding(.top, 75)

View File

@@ -0,0 +1,30 @@
//
// PurpleBackdrop.swift
// damus
//
// Created by William Casarin on 2024-03-04.
//
import SwiftUI
struct PurpleBackdrop<T: View>: View {
@ViewBuilder let content: () -> T
var body: some View {
ZStack {
Color.black
.edgesIgnoringSafeArea(.all)
Image("purple-blue-gradient-1")
.resizable()
.edgesIgnoringSafeArea(.all)
content()
}
}
}
#Preview {
PurpleBackdrop {
Text("Hello, World")
}
}