Change sidebar context menu to use trailing closure syntax

This commit is contained in:
Maurice Parker 2020-07-17 18:05:26 -05:00
parent 067041195d
commit 11bd3dce22
2 changed files with 28 additions and 15 deletions

View File

@ -15,13 +15,15 @@ struct SidebarContextMenu: View {
@ViewBuilder var body: some View { @ViewBuilder var body: some View {
if sidebarItem.representedType == .account { if sidebarItem.representedType == .account {
Button(action: {}) { Button {
} label: {
Text("Get Info") Text("Get Info")
#if os(iOS) #if os(iOS)
AppAssets.getInfoImage AppAssets.getInfoImage
#endif #endif
} }
Button(action: {}) { Button {
} label: {
Text("Mark All As Read") Text("Mark All As Read")
#if os(iOS) #if os(iOS)
AppAssets.markAllAsReadImage AppAssets.markAllAsReadImage
@ -30,7 +32,8 @@ struct SidebarContextMenu: View {
} }
if sidebarItem.representedType == .pseudoFeed { if sidebarItem.representedType == .pseudoFeed {
Button(action: {}) { Button {
} label: {
Text("Mark All As Read") Text("Mark All As Read")
#if os(iOS) #if os(iOS)
AppAssets.markAllAsReadImage AppAssets.markAllAsReadImage
@ -39,46 +42,53 @@ struct SidebarContextMenu: View {
} }
if sidebarItem.representedType == .webFeed { if sidebarItem.representedType == .webFeed {
Button(action: {}) { Button {
} label: {
Text("Get Info") Text("Get Info")
#if os(iOS) #if os(iOS)
AppAssets.getInfoImage AppAssets.getInfoImage
#endif #endif
} }
Button(action: {}) { Button {
} label: {
Text("Mark All As Read") Text("Mark All As Read")
#if os(iOS) #if os(iOS)
AppAssets.markAllAsReadImage AppAssets.markAllAsReadImage
#endif #endif
} }
Divider() Divider()
Button(action: {}) { Button {
} label: {
Text("Open Home Page") Text("Open Home Page")
#if os(iOS) #if os(iOS)
AppAssets.openInBrowserImage AppAssets.openInBrowserImage
#endif #endif
} }
Divider() Divider()
Button(action: {}) { Button {
} label: {
Text("Copy Feed URL") Text("Copy Feed URL")
#if os(iOS) #if os(iOS)
AppAssets.copyImage AppAssets.copyImage
#endif #endif
} }
Button(action: {}) { Button {
} label: {
Text("Copy Home Page URL") Text("Copy Home Page URL")
#if os(iOS) #if os(iOS)
AppAssets.copyImage AppAssets.copyImage
#endif #endif
} }
Divider() Divider()
Button(action: {}) { Button {
} label: {
Text("Rename") Text("Rename")
#if os(iOS) #if os(iOS)
AppAssets.renameImage AppAssets.renameImage
#endif #endif
} }
Button(action: {}) { Button {
} label: {
Text("Delete") Text("Delete")
#if os(iOS) #if os(iOS)
AppAssets.deleteImage AppAssets.deleteImage
@ -87,20 +97,23 @@ struct SidebarContextMenu: View {
} }
if sidebarItem.representedType == .folder { if sidebarItem.representedType == .folder {
Button(action: {}) { Button {
} label: {
Text("Mark All As Read") Text("Mark All As Read")
#if os(iOS) #if os(iOS)
AppAssets.markAllAsReadImage AppAssets.markAllAsReadImage
#endif #endif
} }
Divider() Divider()
Button(action: {}) { Button {
} label: {
Text("Rename") Text("Rename")
#if os(iOS) #if os(iOS)
AppAssets.renameImage AppAssets.renameImage
#endif #endif
} }
Button(action: {}) { Button {
} label: {
Text("Delete") Text("Delete")
#if os(iOS) #if os(iOS)
AppAssets.deleteImage AppAssets.deleteImage

View File

@ -36,9 +36,9 @@ struct SidebarItemView: View {
if let feed = sidebarItem.feed { if let feed = sidebarItem.feed {
feedIconImageLoader.loadImage(for: feed) feedIconImageLoader.loadImage(for: feed)
} }
}.contextMenu(menuItems: { }.contextMenu {
SidebarContextMenu(sidebarItem: sidebarItem) SidebarContextMenu(sidebarItem: sidebarItem)
}) }
} }
} }