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:
@@ -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)
|
||||
|
||||
30
damus/Views/Purple/Detail/PurpleBackdrop.swift
Normal file
30
damus/Views/Purple/Detail/PurpleBackdrop.swift
Normal 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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user