// // BrowseToolbar.swift // Browse // // Created by Javier Cicchelli on 03/12/2022. // Copyright © 2022 Röck+Cöde. All rights reserved. // import DataModels import SwiftUI struct BrowseToolbar: ToolbarContent { // MARK: Properties let createFolder: ActionClosure let uploadFile: ActionClosure let showProfile: ActionClosure // MARK: Body var body: some ToolbarContent { ToolbarItem(placement: .primaryAction) { Menu { Button { createFolder() } label: { Label { Text( "browse.toolbar_item.button.add_folder.text", bundle: .module, comment: "Add folder button text." ) } icon: { Image.newFolder } } Button { uploadFile() } label: { Label { Text( "browse.toolbar_item.button.add_file.text", bundle: .module, comment: "Add file button text." ) } icon: { Image.newFile } } } label: { Label { Text( "browse.toolbar_item.menu.add_actions.text", bundle: .module, comment: "Add actions menu text." ) } icon: { Image.add .foregroundColor(.red) } } } ToolbarItem(placement: .navigationBarTrailing) { Button { showProfile() } label: { Label { Text( "browse.toolbar_item.button.show_profile.text", bundle: .module, comment: "Show profile button text." ) } icon: { Image.profile .foregroundColor(.red) } } } } } // MARK: - Image+Constants private extension Image { static let profile = Image(systemName: "person.crop.circle.fill") static let add = Image(systemName: "plus.circle.fill") static let newFolder = Image(systemName: "folder.badge.plus") static let newFile = Image(systemName: "doc.badge.plus") }