From 92ae0b3b3be08a2244da3a849aa4a4e7e52c6e75 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 6 Jul 2021 16:02:34 +0200 Subject: [PATCH] label to context menu --- .../src/lib/file-explorer-context-menu.tsx | 2 +- .../file-explorer/src/lib/file-explorer.tsx | 36 ++++++++++++------- .../file-explorer/src/lib/types/index.ts | 2 +- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx index 69bdac6f2c..a8a31fd6c8 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx @@ -101,7 +101,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => break } hideContextMenu() - }}>{item.name} + }}>{item.label || item.name} }) } diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index a5cbfb205f..eab163b09e 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -35,7 +35,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'newFolder', name: 'New Folder', @@ -43,7 +44,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'rename', name: 'Rename', @@ -51,7 +53,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'delete', name: 'Delete', @@ -59,7 +62,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'run', name: 'Run', @@ -67,7 +71,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: ['.js'], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'pushChangesToGist', name: 'Push changes to gist', @@ -75,7 +80,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'publishFolderToGist', name: 'Publish folder to gist', @@ -83,7 +89,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'publishFileToGist', name: 'Publish file to gist', @@ -91,7 +98,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'copy', name: 'Copy', @@ -99,7 +107,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }, { id: 'deleteAll', name: 'Delete All', @@ -107,7 +116,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: true + multiselect: true, + label: '' }], focusContext: { element: null, @@ -282,7 +292,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }]) } else { removeMenuItems([{ @@ -292,7 +303,8 @@ export const FileExplorer = (props: FileExplorerProps) => { path: [], extension: [], pattern: [], - multiselect: false + multiselect: false, + label: '' }]) } }, [canPaste]) diff --git a/libs/remix-ui/file-explorer/src/lib/types/index.ts b/libs/remix-ui/file-explorer/src/lib/types/index.ts index 61fcb4d752..c0c27b765f 100644 --- a/libs/remix-ui/file-explorer/src/lib/types/index.ts +++ b/libs/remix-ui/file-explorer/src/lib/types/index.ts @@ -32,7 +32,7 @@ export interface FileExplorerMenuProps { uploadFile: (target: EventTarget & HTMLInputElement) => void } -export type action = { name: string, type: string[], path: string[], extension: string[], pattern: string[], id: string, multiselect: boolean } +export type action = { name: string, type: string[], path: string[], extension: string[], pattern: string[], id: string, multiselect: boolean, label: string } export type MenuItems = action[] export interface FileExplorerContextMenuProps {