mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-10 07:13:28 +01:00
[CHANGE] UI fixes and SwiftUI previews for easier development
This commit is contained in:
@@ -14,6 +14,16 @@ struct ModalNavigationLink<Label: View, Modal: View>: View {
|
||||
|
||||
@State var isPresentingModal: Bool = false
|
||||
|
||||
init(@ViewBuilder modal: @escaping () -> Modal, @ViewBuilder label: @escaping () -> Label) {
|
||||
self.modal = modal
|
||||
self.label = label
|
||||
}
|
||||
|
||||
init(_ title: String, @ViewBuilder modal: @escaping () -> Modal) where Label == Text {
|
||||
self.modal = modal
|
||||
self.label = { Text(title) }
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
SwiftUI.Button {
|
||||
self.isPresentingModal = true
|
||||
@@ -26,8 +36,10 @@ struct ModalNavigationLink<Label: View, Modal: View>: View {
|
||||
}
|
||||
}
|
||||
|
||||
//struct ModalNavigationLink_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// ModalNavigationLink()
|
||||
// }
|
||||
//}
|
||||
struct ModalNavigationLink_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ModalNavigationLink("Present Modal") {
|
||||
Text("Modal")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user