// // 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 ) } icon: { Image.newFolder } } Button { uploadFile() } label: { Label { Text( "browse.toolbar_item.button.add_file.text", bundle: .module ) } icon: { Image.newFile } } } label: { Label { Text( "browse.toolbar_item.menu.add_actions.text", bundle: .module ) } icon: { Image.add .resizable() .scaledToFit() .frame(width: 24, height: 24) } } } ToolbarItem(placement: .navigationBarTrailing) { Button { showProfile() } label: { Label { Text( "browse.toolbar_item.button.show_profile.text", bundle: .module ) } icon: { Image.profile .resizable() .scaledToFit() .frame(width: 24, height: 24) } } } } } // 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") }