diff LazyBear/Views/Global Helpers/Company list/Helpers/ToolbarMenu.swift @ 389:db8bc3ed526a

Implementing add to watchlist feature from SearchView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 25 Apr 2021 16:42:26 +0200
parents
children 4c90e5b18632
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Views/Global Helpers/Company list/Helpers/ToolbarMenu.swift	Sun Apr 25 16:42:26 2021 +0200
@@ -0,0 +1,44 @@
+//
+//  ToolbarMenu.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 25/4/21.
+//
+
+import SwiftUI
+
+struct ToolbarMenu: View {
+    @Binding var showRenameAction: Bool
+    @Binding var showSearchView: Bool
+    @Binding var showDeleteAlert: Bool
+    
+    var body: some View {
+        Menu {
+            Section {
+                Button(action: { showRenameAction = true }) {
+                    Label("Rename list", systemImage: "square.and.pencil")
+                }
+
+                Button(action: { showSearchView = true }) {
+                    Label("Add company", systemImage: "plus")
+                }
+            }
+
+            Section(header: Text("Secondary actions")) {
+                Button(action: { showDeleteAlert = true }) {
+                    Label("Delete list", systemImage: "trash")
+                }
+            }
+        }
+        label: {
+            Label("Options", systemImage: "ellipsis.circle")
+                .imageScale(.large)
+        }
+    }
+}
+
+struct ToolbarMenu_Previews: PreviewProvider {
+    static var previews: some View {
+        ToolbarMenu(showRenameAction: .constant(false), showSearchView: .constant(false), showDeleteAlert: .constant(false))
+    }
+}