Merge pull request #2305 from rizwankce/add-toolbar-button-menu

Add toolbar button menu
This commit is contained in:
Maurice Parker 2020-07-27 11:50:24 -05:00 committed by GitHub
commit c3ca910e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 15 deletions

View File

@ -20,7 +20,6 @@ class SidebarToolbarModel: ObservableObject {
sheetToShow != .none ? (showSheet = true) : (showSheet = false)
}
}
@Published var showActionSheet: Bool = false
@Published var showAddSheet: Bool = false
}

View File

@ -68,21 +68,14 @@ struct SidebarToolbarModifier: ViewModifier {
}
ToolbarItem(placement: .bottomBar, content: {
Button {
viewModel.showActionSheet = true
} label: {
Menu(content: {
Button { viewModel.sheetToShow = .web } label: { Text("Add Web Feed") }
Button { viewModel.sheetToShow = .twitter } label: { Text("Add Twitter Feed") }
Button { viewModel.sheetToShow = .reddit } label: { Text("Add Reddit Feed") }
Button { viewModel.sheetToShow = .folder } label: { Text("Add Folder") }
}, label: {
AppAssets.addMenuImage.font(.title3)
}
.help("Add")
.actionSheet(isPresented: $viewModel.showActionSheet) {
ActionSheet(title: Text("Add"), buttons: [
.cancel(),
.default(Text("Add Web Feed"), action: { viewModel.sheetToShow = .web }),
.default(Text("Add Twitter Feed")),
.default(Text("Add Reddit Feed")),
.default(Text("Add Folder"), action: { viewModel.sheetToShow = .folder })
])
}
})
})
}