From f7d2bfa721e5f0e7ae07072355c299d294ed38ca Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 7 Oct 2022 18:48:16 +0100 Subject: [PATCH] add custom tooltips for file explorer icons --- .../src/lib/components/file-explorer-menu.tsx | 69 +++++++++++-------- .../remix-ui/workspace/src/lib/types/index.ts | 3 +- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx index 4f553f1583..484d76cd50 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx @@ -1,4 +1,6 @@ import React, { useState, useEffect } from 'react' //eslint-disable-line +import { OverlayTrigger, Tooltip } from 'react-bootstrap' +import { Placement } from 'react-bootstrap/esm/Overlay' import { FileExplorerMenuProps } from '../types' const _paq = window._paq = window._paq || [] @@ -8,27 +10,32 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { { action: 'createNewFile', title: 'Create New File', - icon: 'far fa-file' + icon: 'far fa-file', + placement: 'top-end' }, { action: 'createNewFolder', title: 'Create New Folder', - icon: 'far fa-folder' + icon: 'far fa-folder', + placement: 'top-end' }, { action: 'publishToGist', title: 'Publish all the current workspace files (only root) to a github gist', - icon: 'fab fa-github' + icon: 'fab fa-github', + placement: 'top-start' }, { action: 'uploadFile', title: 'Load a local file into current workspace', - icon: 'fa fa-upload' + icon: 'fa fa-upload', + placement: 'bottom-start' }, { action: 'updateGist', title: 'Update the current [gist] explorer', - icon: 'fab fa-github' + icon: 'fab fa-github', + placement: 'right-start' } ].filter(item => props.menuItems && props.menuItems.find((name) => { return name === item.action })), actions: {} @@ -48,14 +55,13 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { <> { props.title } { - state.menuItems.map(({ action, title, icon }, index) => { + state.menuItems.map(({ action, title, icon, placement }, index) => { if (action === 'uploadFile') { return (