Move Settings button to PostList

This commit is contained in:
Angelo Stavrow 2020-08-10 16:50:24 -04:00
parent 94322a0424
commit 275dd91e9c
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
3 changed files with 17 additions and 24 deletions

View File

@ -4,27 +4,7 @@ struct SidebarView: View {
@State var isPresentingSettings = false
var body: some View {
#if os(iOS)
VStack {
CollectionListView()
Spacer()
Button(action: {
isPresentingSettings = true
}, label: {
Text("Settings")
}).sheet(
isPresented: $isPresentingSettings,
onDismiss: {
isPresentingSettings = false
},
content: {
SettingsView(isPresented: $isPresentingSettings)
}
)
}
#else
CollectionListView()
#endif
}
}

View File

@ -3,6 +3,7 @@ import SwiftUI
struct PostList: View {
@EnvironmentObject var postStore: PostStore
@State var selectedCollection: PostCollection
@State var isPresentingSettings = false
var body: some View {
#if os(iOS)
@ -27,15 +28,27 @@ struct PostList: View {
Image(systemName: "square.and.pencil")
})
}
ToolbarItem(placement: .bottomBar) {
Button(action: {
isPresentingSettings = true
}, label: {
Image(systemName: "gear")
}).sheet(
isPresented: $isPresentingSettings,
onDismiss: {
isPresentingSettings = false
},
content: {
SettingsView(isPresented: $isPresentingSettings)
}
)
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
ToolbarItem(placement: .bottomBar) {
Text(pluralizedPostCount(for: showPosts(for: selectedCollection)))
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
}
#else //if os(macOS)
List {

View File

@ -7,7 +7,7 @@ struct SettingsView: View {
VStack {
SettingsHeaderView(isPresented: $isPresented)
Form {
Section(header: Text("Account")) {
Section(header: Text("Login Details")) {
AccountView()
}
Section(header: Text("Appearance")) {